Patchwork API - Example test walk-through

Number of APIs: 5

Overview

  • Get a JWT token with hubUserLogin
  • Create and update shifts with syncExternalShift
  • Read updates using a shifts query

When the collection is run in order, several of the examples populate variables that are used in later examples using the scripts in the Tests tab of the request.

You will need to update the url variable to the specific environment your test account was set up on.

Some examples highlight key details of the results in the Visualize tab.

Authentication

The hubUserLogin example uses email and password from the collection variables and when run using Send will populate the jwt value for you so other requests are authenticated. Be sure to only update the current values so you don't leak your credentials.

currentOgranisation

The currentOrganisation will return information such as departments and sites which can be used for verifying details required to create and update shifts.

syncExternalShift

The syncExternalShift mutation will create or update shifts using the externalId and other details passed in. This mutation is designed to be hit repeatedly and will calculate what changes need to be made - if any - each time.

  1. Authentication - Refresh a token POST {{url}}

  2. currentOrganisation - Query for External Unit POST {{url}}

  3. syncExternalShift - Delete a Shift POST {{url}}

  4. shifts - Query Shift by Hub Id POST {{url}}

  5. workedShifts - Query workedShifts with all bank worked shifts POST {{url}}