Location Refresh Webhook
The Location Refresh webhook automates the process of handling location closures and changes to hours of operation.
Important Note: This webhook requires the Get Location endpoint for each location within the List Locations endpoint.
Step 1: Call the Location Refresh Endpoint
The location refresh endpoint requires an internal Grubhub merchant ID within the URL and a merchant token for the authorization. Both fields can be generated and provided by a Grubhub engineer for both production and sandbox environments.
Request Endpoints
Production:
POST https://api.thelevelup.com/v15/merchants/:merchant_id/refresh_locations
Sandbox:
POST https://api.sandbox-levelup.com/v15/merchants/:merchant_id/refresh_locations
Example Response Body
{
"provider_location_ids": [
11111,
12344
]
}
Example CURL Command
curl -X POST \
https://api.thelevelup.com/v15/merchants/123456/refresh_locations \
-H 'Accept: application/json' \
-H 'Authorization: token merchant=XXXXX-XXXXX-XXXXX-XXXXXX-XXXXXX' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"provider_location_ids": [
11111,
12344
]
}'
Example Response Schema
{
"type": "object",
"properties": {
"provider_location_ids": {
"type": "array",
"items": {
"type": "integer",
"description": "The provider ID of the location that needs to be refreshed"
}
}
},
"required": [
"provider_location_ids"
]
}
Step 2: Return the Correct Hours or Closure Information
When Grubhub receives the call to the refresh_locations endpoint, we pull the details for each location list in the provider_location_ids array by calling the Get Location endpoint.
Please return the updated hours in the "hours" attribute in your response for the Get Location endpoint. For more details, see the “Handling Hours” section in the Get Locations endpoint documentation.
To close a location temporarily, use the value "closed", as described in the documentation. You may also change a location's value for "active" to false and this disables the store for any orders until that flag is toggled back to true.