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

  • Set this header to application/json.

  • Advertises which content types the client is able to understand

  • The signature for the API call

  • Used to identify the software, device, and application initiating the request, providing information about the client to the server. For details, see User Agent.

  • Used to authorize the request with access_token. It should be supplied as Bearer ACCESS_TOKEN_GOES_HERE.

Body

application/json
  • OAuth client ID provided by the business

  • Access token of the user

  • Properties: 2
  • If set to "true", it returns the headers of each API call in the batch. Disabled by default

Responses

  • application/json
  • application/json
Request Example for post/api2/mobile/batch_api
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"
  }
]