Making Batch Requests
Batching allows you to pass instructions for several operations in a single HTTP request. Punchh will process each of your API calls sequentially / in parallel (to be decided). Once all operations have been completed, a consolidated response will be passed back to you.
Headers
- Type: stringContent
- Type requiredSet this header to application/json.
- Type: stringAcceptrequired
Advertises which content types the client is able to understand
- Type: stringx
-pch -digest requiredThe signature for the API call
- Type: stringUser
- Agent requiredUsed to identify the software, device, and application initiating the request, providing information about the client to the server. For details, see User Agent.
- Type: stringAuthorizationrequired
Used to authorize the request with access_token. It should be supplied as
Bearer ACCESS_TOKEN_GOES_HERE.
Body
- Type: stringclientrequired
OAuth client ID provided by the business
- Type: stringaccess
_token Access token of the user
- Properties: 2Type: array of objectbatch
- Type: booleanshow
_headers _in _response If set to "true", it returns the headers of each API call in the batch. Disabled by default
Responses
- application/json
- application/json
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/mobile/batch_api \
--request POST \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-pch-digest: {{$$.env.signature}}' \
--header 'User-Agent: AppName/AppVersion/BuildNumber (OS; Model; MANUFACTURER; MODEL; OS Version)' \
--header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
--data '{
"client": "CLIENT_KEY_GOES_HERE",
"access_token": "ACCESS_TOKEN_GOES_HERE",
"batch": [
{
"http_verb": "get",
"uri": "URI_GOES_HERE"
}
],
"show_headers_in_response": false
}'
[
{
"response_status_code": 0,
"http_verb": "put",
"uri": "URI_GOES_HERE",
"body": "string"
}
]