Soft-Contact / resto

Soft-Contact's Restolution software related materials
5 stars 6 forks source link

Restolution JSON API "importTimeTrackings" #18

Closed limealot closed 1 year ago

limealot commented 1 year ago

importTimeTrackings

For importing new time trackings that represent performed work hours in a unit of a restaurant. The time trackings are imported as an array of TimeTracking objects. Each time tracking object has it's employee number and unit UUID and the import will update the time tracking of the clerk(s) in Restolution that are linked to the employee for the given unit. If any part of the imported time tracking (A) already exists for the clerk and unit in a previously stored time tracking (B), this part will be omitted, i.e. the union (A ∪ B) of the existing and the new time tracking period will be stored in Restolution. If several Restolution clients share the same API Key, the time tracking import will affect all clients that have matching employee numbers and unit UUIDs. Note, however, that since the unit UUID is globally unique it is not possible for a single time tracking object to be imported to more than one unit (and client).

parameters:

response:

A "savedTimeTrackings" object that contains the following fields:

sample request:

{
  "timestamp": "2022-11-15T08:58:40.988Z",
  "apiKey": "user_321681",
  "requestID": "test_request_id",
  "method": "importTimeTrackings",
  "params": {
    "timeTrackings": [
      {
        "employeeNumber": "123",
        "unitUUID": "12abcbdb-0244-4820-8a2a-e85e874ec8c9",
        "startTime": "2022-11-08T07:00:00Z",
        "endTime": "2022-11-08T15:00:00Z"
      },
      {
        "employeeNumber": "234",
        "unitUUID": "12abcbdb-0244-4820-8a2a-e85e874ec8d5",
        "startTime": "2022-11-08T08:00:00Z",
        "endTime": "2022-11-08T16:00:00Z"
      }
    ]
  }
}

sample response:

{
  "success": true,
  "timestamp": "2022-11-15T14:19:09.246Z",
  "requestID": "test_request_id",
  "response": {
    "savedTimetrackings": {
      "timeTrackings": 2,
      "added": 2,
      "clients": 1
    }
  }
}

TimeTracking

See also importTimeTrackings

limealot commented 1 year ago

Merged to main specification document.