API batch | How to use API batches to dynamically resolve external IDs in a single API request

Posted about 1 year ago by Julien Pauthier

Julien Pauthier
Julien Pauthier Admin

API batches can be leverage to minimize the network&authentication of multiple API requests, but you can use them as well to avoid relying on Agendize IDs when updating or deleting items, or fetching time slots based on your location ID in your own directory and on the service reference in your system.


Here is an example:


POST https://app.agendize.com/api/2.3/batch


{
  "requests": [
    {
      "name": "get-company",
      "path": "/api/2.1/scheduling/companies/YOUR_LOCATION_ID_IN_YOUR_OWN_SYSTEM",
      "method": "GET"
    },
    {
      "name": "get-service",
      "path": "/api/2.1/scheduling/companies/${result=get-company:$.id}/services/SERVICE_ID_IN_YOUR_OWN_SYSTEM",
      "method": "GET"
    },
    {
      "path": "/api/2.1/scheduling/companies/${result=get-company:$.id}/widget/nextSlots?number=20&serviceId=${result=get-service:$.id}",
      "method": "GET"
    }
  ]
}


0 Votes


0 Comments

Login or Sign up to post a comment