Manipulating resources


Creating a resource

You can create a resource by performing a POST-request to the relevant resource-collection:

// POST https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/<resource-collection>
{
	"attribute":"value",
    // ...
}

// Response: 201 Created
// Location: /connector/protimeapi/api/v1/<resource-collection>/<resource-id>
Example for creating an InOut clocking
// POST https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings
{
	"person":{
		"id":76547
	},
	"date":"2024-01-05",
	"timeOfDayInMinutes":480,
	"terminal":{
		"id":765
	},
	"geolocation":{
		"longitude":"51.144127",
		"lattitude":"4.392225"
	},
	"kind":"InOut"
}
// Response: 201 Created
// Location: /connector/protimeapi/api/v1/clockings/8192

For details about the content please refer to the Swagger documentation.

A successful POST will always return one of the following options:

  • 201-Created with at least a Location header
  • 202-Accepted with an Operation-Location header to the status-monitor.

For more information, please look at Response.

Updating a resource

The PUT method is used to update a resource. When making a PUT request, the request body must include all non-read-only fields required by the resource. If the request body includes read-only fields, the server will ignore these fields.

// PUT https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/<resource-collection>/<resource-id>
{
	"attribute":"value",
    // ...
}

// Response: 200 OK
{
    "id": "<resource-id>",
    "attribute": "value",
    // ...
}

A successful PUT will always return one of the following options:

  • 200-Existing resource updated
  • 202-Accepted with an Operation-Location header to the status-monitor.

For more information, please look at Response.

Creating or updating a resource

In some endpoints, a PUT request can either create or update a resource. Whether the resource is new or existing is determined by the resource ID. If the ID corresponds to an existing resource, it will be updated; if it does not exist, a new resource will be created with that ID. This way of creating a resource will mostly be used in combination with external references.

// PUT https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/<resource-collection>/<resource-id>
{
	"attribute":"value",
    // ...
}

// Response: 201 Created
{
    "id": "<resource-id>",
    "attribute": "value",
    // ...
}

A successful PUT will always return one of the following options:

  • 200-Existing resource updated
  • 201-Created with at least a Location header
  • 202-Accepted with an Operation-Location header to the status-monitor.

For more information, please look at Response.

Deleting a resource

DELETE requests are used to remove a resource. This operation is idempotent, meaning that performing it multiple times will have the same result. If the resource does not exist, the DELETE request will still respond with a 204 No Content, just as it would for a successful deletion of an existing resource.

// DELETE https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/<resource-collection>/<resource-id>

// Response: 204 No Content

A successful DELETE will always return:

  • 204-No Content

For more information, please look at Response.