Shifts operations

Get user’s timeline

Perform GET request to find out user’s timeline. Operation requires after and before query parameters of Date type which should be one week apart at most.

$ curl -H "Authorization: Bearer api-key" https://api.planadoapp.com/v2/users/c855dc30-11ce-4a64-98f9-4951d9fa2da7/shifts?after="2022-07-18"&before="2022-07-19" | jq
{
  "timeline": [
    {
      "time_from": "2022-07-18T00:00:00+00:00",
      "time_to": "2022-07-18T08:00:00+00:00",
      "working": false,
      "territory": null,
      "job_type": null
    },
    {
      "time_from": "2022-07-18T08:00:00+00:00",
      "time_to": "2022-07-18T10:00:00+00:00",
      "working": true,
      "territory": {
        "uuid": "f42399cc-a501-48eb-92d9-7dc3a98b7f01",
        "name": "territory #3"
      },
      "job_type": {
        "uuid": "fe2f90b2-2282-42fe-855b-c90fc25d774c",
        "code": "Maintenance"
      }
    },
    {
      "time_from": "2022-07-18T10:00:00+00:00",
      "time_to": "2022-07-18T15:00:00+00:00",
      "working": true,
      "territory": {
        "uuid": "216fb26c-b3a0-4995-80eb-7fe0e331d058",
        "name": "South London"
      },
      "job_type": {
        "uuid": "42108f82-89d5-42b8-919b-c9a2be68941f",
        "code": "On-premise"
      }
    },
    {
      "time_from": "2022-07-18T15:00:00+00:00",
      "time_to": "2022-07-19T00:00:00+00:00",
      "working": true,
      "territory": {
        "uuid": "f42399cc-a501-48eb-92d9-7dc3a98b7f01",
        "name": "territory #3"
      },
      "job_type": {
        "uuid": "77e9fb1f-c9a9-461d-b169-ef595d61cdf0",
        "code": "Delivery"
      }
    }
  ]
}

Add or edit timelines

To add or edit user’s shifts send PATCH request with shifts array containing settings in its body.

$ curl -H "Authorization: Bearer api-key" \
       -X PATCH \
       https://api.planadoapp.com/v2/users/c855dc30-11ce-4a64-98f9-4951d9fa2da7/shifts \
       --data @- << EOF
{
  "shifts": [
    {
      "time_from": "2022-07-19T08:00:00+00:00",
      "time_to": "2022-07-19T12:00:00+00:00",
      "working": true,
      "job_type": {
        "code": "Repair"
      }
    }, {
      "time_from": "2022-07-18T13:00:00+00:00",
      "time_to": "2022-07-19T18:00:00+00:00",
      "job_type": {
        "uuid": "1ed090d9-1977-6660-a7ed-429baf688d7b"
      },
      "territory": {
        "name": "South London"
      }
    }
  ]
}
EOF
Table 1. Fields of shifts elements
Поле Тип JSON type Can be null Описание

time_from

Datetime

String

No

Interval start

time_to

Datetime

String

No

Interval end

working

Boolean

Boolean

Yes

Does user work. true if missing

territory

Territory

Object

Yes

Territory

job_type

Job type

Object

Yes

Job type

Successful request returns 204 (No Content) without any payload.