Create an assignment

Create an assignment

Introduction

You can create an assignment with the POST call.

Caution

This endpoint is only available if clients are not using Planning Flex or Shift.

Tip

Check the Swagger page for more technical information on the endpoints.

Endpoint details

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/assignments

Body properties

This list of properties is applicable for this endpoint.

Property Type Description
person.id integer Internal ID of the person who the assignment is for. Required (or use external reference)
from string Start date of the assignment (YYYY-MM-DD). Required
until string End date of the assignment (YYYY-MM-DD).
startTimeInMinutes integer Start time in minutes since midnight (-1440 and 2880).
endTimeInMinutes integer End time in minutes since midnight (-1440 and 2880).
breakDurationInMinutes integer Duration of the break in minutes.
comments string Comments associated with the assignment.
activityLevels.level integer A list of levels in the activity structure of the registered activity definition.
activityLevels.activityDefinition.id string Unique identifier for the activity definition registered.

External references

It’s possible to use predefined external references and custom external references. More information can be found on the External References Page.

The following collections are supported for this endpoint:

Collection Predefined Custom
people @badge-number, @employee-number Supported
activity-definitions @data-entry-code, @external-reference Supported

Examples

Create an assignment with internal IDs

Example creating an assignment for person with ID 1234:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/assignments

{
  "person": {
    "id": 1234
  },
  "from": "2025-03-10",
  "until": "2025-03-10",
  "startTimeInMinutes": 480,
  "endTimeInMinutes": 1020,
  "breakDurationInMinutes": 30,
  "comments": "Morning shift",
  "activityLevels": [
    {
      "level": 1,
      "activityDefinition": {
        "id": "a7d853ea-89eb-4735-83d1-b891c6fde398"
      }
    }
  ]
}

Create an assignment with external reference for person

Example creating an assignment using the employee number as the external reference:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/assignments

{
  "person": {
    "externalReferences": {
      "@employee-number": "5678"
    }
  },
  "from": "2025-03-10",
  "until": "2025-03-10",
  "startTimeInMinutes": 480,
  "endTimeInMinutes": 1020,
  "breakDurationInMinutes": 30,
  "activityLevels": [
    {
      "level": 1,
      "activityDefinition": {
        "id": "a7d853ea-89eb-4735-83d1-b891c6fde398"
      }
    }
  ]
}

Create an assignment with multiple activity levels

Example creating an assignment with multiple activity levels:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/assignments

{
  "person": {
    "id": 1234
  },
  "from": "2025-03-10",
  "until": "2025-03-10",
  "startTimeInMinutes": 480,
  "endTimeInMinutes": 1020,
  "breakDurationInMinutes": 30,
  "activityLevels": [
    {
      "level": 1,
      "activityDefinition": {
        "id": "a7d853ea-89eb-4735-83d1-b891c6fde398"
      }
    },
    {
      "level": 2,
      "activityDefinition": {
        "id": "22d320ed-f6ed-44bd-b7b1-fe58f518960c"
      }
    }
  ]
}