Create usage

Introduction

Create a new usage for an activity definition to limit who can use it. You can assign usage rights to circles, groups, or individual people.

Tip

Check the Swagger page for more technical information on the endpoints.

Endpoint details

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/{structureVersionId}/levels/{level}/activity-definitions/{activityDefinitionReference}/usages

URL parameters

These parameters need to be filled in when calling this endpoint.

Parameter Description
<structureVersionId> The ID of the activity structure. Can be found in the configuration in myProtime.
<level> Defines the level in the structure.
<activityDefinitionReference> The internal ID or an external reference.

Body properties

This list of properties is applicable for this endpoint.

Property Type Description
activityUsageKind string Determines the rights on People, Groups, or Circles. Valid values: Person, Group, Circle.
usageReference.id integer ID or a Custom external reference.
from string Start date of the usage (YYYY-MM-DD). Required
until string End date of the usage (YYYY-MM-DD). If no end date is required, omit “until” or send it as an empty string ("").

External references

It’s possible to use predefined external references and custom external references. More information can be found on the External References Page.

For a list of predefined external references, see the external reference options section.

Note

Check the query options below the endpoint on the Swagger page for the relevant external references.

Caution

There are some restrictions on the characters allowed in URL requests. See the fetching resources page for more information.

Good to Know

Overlapping usages

Usages cannot have overlapping date periods for the same combination of activity definition, usage kind, and usage reference. If you attempt to create a usage where the start and end dates overlap with an existing usage record, the API will return an error indicating that overlapping usages are not allowed.

To add a usage during an already covered period, you must first modify or delete the existing usage.

Examples

Create usage for a circle

Example creating usage for circle with ID 13:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/b2347a7a-d60d-446f-b03b-7es2cc8c3281/levels/3/activity-definitions/38fc2206-b51f-434a-9c36-9e0esfc5e70e/usages

{
  "activityUsageKind": "Circle",
  "usageReference": {
    "id": 13
  },
  "from": "2025-01-01",
  "until": "2025-12-31"
}

Create usage for a group

Example creating usage for group with ID 5:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/b2347a7a-d60d-446f-b03b-7es2cc8c3281/levels/2/activity-definitions/22d320ed-f6ed-44bd-b7b1-fe58f518960c/usages

{
  "activityUsageKind": "Group",
  "usageReference": {
    "id": 5
  },
  "from": "2025-01-01"
}

Create usage for a person

Example creating usage for person with ID 1234:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/b2347a7a-d60d-446f-b03b-7es2cc8c3281/levels/1/activity-definitions/a7d853ea-89eb-4735-83d1-b891c6fde398/usages

{
  "activityUsageKind": "Person",
  "usageReference": {
    "id": 1234
  },
  "from": "2025-01-01",
  "until": "2026-01-01"
}

Create open-ended usage (no end date)

Example creating open-ended usage for circle with ID 20:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/b2347a7a-d60d-446f-b03b-7es2cc8c3281/levels/3/activity-definitions/38fc2206-b51f-434a-9c36-9e0esfc5e70e/usages

{
  "activityUsageKind": "Circle",
  "usageReference": {
    "id": 20
  },
  "from": "2025-01-01"
}