Create a service

This endpoint enables the creation of a new service within the business.

POST /api/v2/businesses/{businessId}/services

Below is a detailed explanation of each field that can be included in the request body. Some of them are required for the request to be processed successfully.

Required fields are marked with an asterisk (*).

Request body

JSON Analysis
{
  "newServiceOuterId": "string",
  "newServiceName": "string",
  "copyFromServiceOuterId": "string",
  "timeZone": "string",
  "firstDayOfWeek": 1,
  "parentOuterId": "string"
}
Details
  • newServiceOuterId: external identifier of the new service. Although not mandatory, it is recommended to define it so it can be used in future integration operations. It must be unique within the business.

  • newServiceName*: name of the new service.

  • copyFromServiceOuterId: external identifier of the service to be used as a reference if a copy is to be made.

  • timeZone*: time zone in which the service will be created. It is mandatory to provide a TZ identifier from this list.

  • firstDayOfWeek*: first day of the week. It is mandatory to include a value from 1 (Monday) to 7 (Sunday).

  • parentOuterId*: external identifier of the node to which the service will be linked.

Request example

After analyzing the different fields, here is an example of the request body:

{
    "newServiceOuterId": "1327",
    "newServiceName": "STORE 1327",
    "timeZone": "Africa/Freetown",
    "firstDayOfWeek": 1,
    "copyFromServiceOuterId": "0001",
    "parentOuterId": "PN"
}

Considerations

If the external identifier specified for the new service already exists within the business, the request will return a 409 - Conflict error with the message ID already exists.

If the name of the new service is not provided, the request will return a 406 - Not Acceptable error with the message must not be null.

If the firstDayOfWeek field is not sent or its value is not one of the allowed options, the request will return a 400 - Bad Request error with the message Invalid firstDayOfWeek. Must be an integer between 1 (monday) and 7 (sunday).

If the copyFromServiceOuterId field is provided, all dependent entities of the referenced service will be copied: products, locations, zones, employee limits, needs templates, employee distribution, service times, service parameters, regulations, employee roles, etc.

If the external node identifier (parentOuterId) does not match any configured at the business level, the request will return a 404 - Not Found error with the message Node not found.

What is a service?

What is a node?