Lets Talk about...

API

(of shyftplan)

Roadmap

What

API stands for ...

What can i do with an API?

Import Data

Export Data

Write Commands

Add notifications

Why

Why do i need an API for that?

UI

(User Interface)

How

How does the data from

the API look like?

{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}
{
  "id": 6359714,
  "locations_position_id": 33291,
  "starts_at": "2018-02-28T07:00:00.000+01:00",
  "ends_at": "2018-02-28T15:30:00.000+01:00",
  "workers": 4,
  "can_evaluate": true,
  "note": "We need to do a release today"
}

How to get the data?

API Playground

API Action

HTTP Method

URL

Parameters

API Playground

Authentication

Authentication

Authentication Token

API Playground

At shyftplan

Models

User

User

{
  "id": 1337,             // Id of User
  "email": "tamino@...",  // Login mail address
  "created_at": ...,
  "updated_at": ...,      // Timestamps
  "deleted_at": ...
}

Employment

Employment

"id": 1337,             // Id of Employment
"user_id": 4711,        // Id of User
"company_id": 54,       // Id of Company
"is_employee": true,    // Is the user an employee?
"is_stakeholder": true, // Is the user an stakeholder?
"first_name": "Foo",    // First Name
"last_name": "Bar",     // Last Name

Position

Position

"id": 1337,             // Id of Position
"company_id": 54,       // Id of Company
"name": "Foo",          // Position Name
"description": "",      // Descripton
"color": "#aaeee1",     // Background color
"sort": 13,             // Used to order them
"text_color": "#000",   // Foreground color (black / white)
"note": ""              // Position Note

Location

Location

"id": 1337,             // Id of Location
"company_id": 54,       // Id of Company
"name": "Foo",          // Position Name
"sort": 13,             // Used to order them

LocationsPosition

LocationsPosition

"id": 1337,             // Id of LocationsPosition
"location_id": 4711,    // Id of Location
"position_id": 815,     // Id of Position
"sort": 13,             // Used to order them

EmploymentsPosition

EmploymentsPosition

"id": 1337,             // Id of EmploymentsPosition
"employment_id": 4711,  // Id of Location
"locations_position_id": 815, // Id of LoctionsPosition

Shiftplan

Shiftplan

"id": 1337,             // Id of Shiftplan
"location_id": 58,      // Id of Location
"starts_at": "yyyy-mm-dd", // Shiftplan goes from this date
"ends_at": "yyyy-mm-dd",   // to this date (both included)
"state": "published",   // State (published/unpublished)
"name": "Foo",          // Shiftplan name

Shift

Shift

"id": 1337,             // Id of Shift
"shiftplan_id": 4711,   // Id of Shiftplan
"locations_position_id": 815, // Id of LocationsPosition
"starts_at": "...",     // Shift goes from this time
"ends_at": "...",       // to this time (ISO 8601 format)
"workers": 1,           // Maximum amount of workers
"break_time": 0,        // Duration of breaks (in minutes)
"can_evaluate": true,   // Can be evaluated by employees
"note": null,           // Shift Note
"untimed": false,       // If shifts time counted?
"manager_note": null    // Manager Note

StaffShift

StaffShift

"id": 1337,             // Id of StaffShift
"shift_id": 4711,       // Id of Shift
"employment_id": 815,   // Id of Employment
"state": "no_evaluation", // Current Evaluation state
                          // - no_evaluation
                          // - done_evaluation
                          // - needs_evaluation
                          // - punchtimed
                          // - no_show
"total_minutes": 241,   // Working time (without break)
"total_payment": 50.21  // Sum of all payments

Request

Request

"id": 1337,             // Id of Request
"shift_id": 4711,       // Id of Shift
"employment_id": 815,   // Id of Employment
"type": "StaffRequest"  // Type of Request
                        // - StaffRequest
                        // - ChangeRequest

Evaluation

"id": 1337,             // Id of StaffShift
"shift_id": 4711,       // Id of Shift
"employment_id": 815,   // Id of Employment
"locations_position_id": 54, // Id of LocationsPosition
"shiftplan_id": 136,    // Id of Shiftplan
"location_id": 58,      // Id of Location
"position_id": 96,      // Id of Position
"user_id": 405,         // Id of User
"first_name": "Foo",    // First Name of Employment
"last_name": "Bar",     // Last Name of Employment
"evaluation_starts_at": ..., // Evaluated Start of Shift
"evaluation_ends_at": ...,   // Evaluated End of Shift
"evaluation_break": 0,       // Break time in minutes
"evaluation_duration": 330,  // Working time in minutes
"state": "no_evaluation",    // State of Evaluation
"shift_note": null,               // Shift note
"admin_evaluation_note": null,    // Stakeholder Note
"employee_evaluation_note": null, // Employee Note
"position": {
  "name": "Foo"        // Position Name
},
"location": {
  "name": "Bar"        // Location Name
},
"shift": {
  "starts_at": ...,    // Planned Shift Start
  "ends_at": ...,      // Planned Shift End
  "break_time": 0      // Planned Shift Break Time
}

Bonus Track

API Playground

Open inspector

⌘ + ⌥ + i

Fetch URL

Save data

Play around

 

Thats it

Whats next?

Questions?