Prerequisites

To follow this examples, you need:

  • A tool to send HTTP requests, e.g., curl or Postman.
  • The id crewId of your crew. The crewId is a number that uniquely identifies your crew in the crewmeister system. You find the crewId by visiting your crew in the browser and, after the page has fully loaded, checking the url in the browser. It should look similar to this https://app.crewmeister.com/crew/150/time-tracking. The crewId is the number that appears behind https://app.crewmeister.com/crew, so in this example the crewId is 150.
  • The user identifier (email or user login name) and the corresponding password of the user in which context you want the API calls to be performed.

Get user authentication token and id

For most API calls, you will need to send a user authentication token and the userId of the user as part of the call.

For the example, we assume the user has the email address email@crewmeister.com and the password secret.

Request: curl -X POST -H "Content-Type: application/json" -d '{"userIdentifier": "email@crewmeister.com", "password": "secret"}' https://api.crewmeister.com/api/v2/user/authentication

Response: {"message":"Success","payload":{"id":100,"token":"AJW1Y_giyy1CiSXtmyPD"}

The id and the token will be required for making authenticated calls in the next examples.

Read example: Getting a list of all groups in a crew with crewId 150

You can only access data for crews to which your user has permission. In this example, it is assumed that the user authenticated with the id and the token from the previous section has the required permissions. You send those values as special headers X-cmAuthenticationUserId and X-cmAuthenticationToken.

Request: curl -X GET -H "Content-Type: application/json" -H "X-cmAuthenticationUserId: 100" -H "X-cmAuthenticationUserToken: AJW1Y_giyy1CiSXtmyPD" https://api.crewmeister.com/api/v2/crew/150/group

Response: {"message":"Success","payload":[{"crewId":100,"disabledAt":null,"id":12,"name":"Group A"}...]}

The payload contains an array with all groups of the crew. Each group has a unique id.

Write example: Renaming a group in a crew with crewId 150

Rename the group with id 12 in the crew with id 150 to "New Name"

Request: curl -X POST -H "Content-Type: application/json" -H "X-cmAuthenticationUserId: 100" -H "X-cmAuthenticationUserToken: AJW1Y_giyy1CiSXtmyPD" -d '{"name": "New Name"}' https://api.crewmeister.com/api/v2/crew/150/group/12

Response: {"message":"Success","payload":{"crewId":150,"disabledAt":null,"id":12,"name":"New Name"},"statusCode":200}

The payload contains an object with the updated crew