Agendize Client API

Batch

On February 28th, 2021 we released the version 2.3 of the Batch API. the previous version's documentation is still available here.


The batch API enables you to process several API requests in a row, along one single authentication.

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

For instance, you can create three services at one location:

{ "requests": [ { "path": "/api/2.1/scheduling/companies/000000/services", "method": "POST", "body": { "name":"Service 1" } }, { "path": "/api/2.1/scheduling/companies/000000/services", "method": "POST", "body": { "name":"Service 2" } }, { "path": "/api/2.1/scheduling/companies/000000/services", "method": "POST", "body": { "name":"Service 3" } } ] }

You can of course use distinct types of API requests in one single batch ; for instance, you can create a new service and retrieve a list of appointments:

{ "requests": [ { "path": "/api/2.1/scheduling/companies/000000/services", "method": "POST", "body": { "name":"service 1" } }, { "path": "/api/2.1/scheduling/companies/000000/appointments", "method": "GET" } ] }

It is also possible to use the resulting ID of an API request previously used in the same batch, so that you can refer to it:

{ "requests": [ { "path": "/api/2.1/scheduling/companies", "method": "POST", "name": "add-company", "body": { "name": "My Location" } }, { "path": "/api/2.1/scheduling/companies/${result=add-company:$.id}/services", "method": "POST", "name": "add-service", "body": { "name": "My Service" } }, { "path": "/api/2.1/scheduling/companies/${result=add-company:$.id}/staff", "method": "POST", "body": { "firstName": "John", "lastName": "Doe", "email": "test@acme.com", "services": [ { "id": "${result=add-company:$.id}" } ] } } ] }

The first API request creates a location, and its ID is used in the second API request to populate the newly created location with a new service. Finally, the third API request creates a new staff and assigns it to the new service at that location.

You can also use nest batches to reflect the sequence of requests:

{ "requests": [ { "path": "/api/2.1/scheduling/companies", "method": "POST", "name": "parent", "body": { "name": "My Location" }, "requests" : [ { "path": "/api/2.1/scheduling/companies/${result=parent:$.id}/services", "method": "POST", "body": { "name": "My Service" } }, { "path": "/api/2.1/scheduling/companies/${result=parent:$.id}/staff", "method": "POST", "body": { "lastName": "Smith", "email": "test@acme.com" } } ] } ] }

In this previous example you can see jsonpath expressions like $.id. POST, PUT and PATCH request bodies supports jsonpath expressions to inject calculated data.

You can also set header parameters:

{ "requests": [ { "path": "/api/2.1/scheduling/companies", "method": "GET", "headers": { "apiKey": "xxxxxxxxx", "token": "zzzzzzzzzz" } } ] }