API batch | Reseller | Service creation

Here is an example of an API batch that retrieves the SSO token of one of the reseller's clients, fetches the first company and creates a new service associated with all staffs:


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


{
  "requests": [
    {
      "name": "get-reseller-child-account",
      "path": "/api/2.0/resellers/accounts/{{ACCOUNT ID or EXTERNAL ID}}",
      "method": "GET"
    },
    {
      "name": "get-company",
      "path": "/api/2.1/scheduling/companies",
      "method": "GET",
      "headers": {
        "token": "${result=get-reseller-child-account:$.ssoToken}"
      }
    },
    {
      "path": "/api/2.1/scheduling/companies/${result=get-company:$.items[0].id}/services?staff=all",
      "method": "POST",
      "headers": {
        "token": "${result=get-reseller-child-account:$.ssoToken}"
      },
      "body": {
        "allowBookingIteration": false,
        "availability": "public",
        "bufferDuration": 0,
        "price": 0,
        "capacity": 1,
        "description": "",
        "color": "#FF5454",
        "duration": 30,
        "maxAppointmentsPerDay": 1,
        "name": "Assistance",
        "overNight": false,
        "overNightStartTime": "",
        "payable": false
      }
    }
  ]
}


Login or Signup to post a comment