Create activity definition
Creates a new activity definition record.
Tip
Check the Swagger page for more technical information on the endpoints.
Endpoint details
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/{structureVersionId}/levels/{level}/activity-definitions
Headers: Authorization: Bearer {token}, User-Agent: {agent}
Scope: connector-protimeapi-activity-definitions.write
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. |
Body properties
| Field | Type | Required | Writable | Description |
|---|---|---|---|---|
name.default |
string | Yes | Yes | Default name value of the activity definition. Shown to users if no translation is available. |
name.translations |
object | No | Yes | A list of translated names by language code. Allows localization for different languages. |
parent.id |
Guid | No | Yes | Unique identifier of the parent activity definition in a hierarchy set-up. |
parent.externalReferences |
object | No | Yes | External references to resolve the parent activity definition. |
shortCode |
string | No | Yes | Short code for the activity definition. |
dataEntryCode |
string | No | Yes | Data entry code for the activity definition, mostly used on hardware devices. Mandatory or optional depending on configuration. Can only be 16 characters long! |
externalReference |
string | No | Yes | External reference identifier for the activity definition. Needs to be unique within the structure and level when used! Can only be 16 characters long! |
info |
string | No | Yes | Additional information about the activity definition. Can be used for notes or extra details. |
activeFrom |
date | No | Yes | Start date (YYYY-MM-DD) when the activity definition is active. Controls when the definition becomes available for registrations. |
activeUntil |
date | No | Yes | End date (YYYY-MM-DD) when the activity definition is no longer active. Must be greater than or equal to activeFrom when both are specified. |
Tip
If your configuration requires users to manually enter the data entry code when creating an activity definition, the dataEntryCode field is mandatory and must be provided in the request body. It cannot be null or omitted. If this field is missing, the API will return a 400 Bad Request error. Please ensure you include dataEntryCode when required by your configuration.
External references
The endpoint supports predefined and custom external references. See the external references page for details.
The following collections are supported for this endpoint:
| Collection | Predefined | Custom |
|---|---|---|
activity-definitions |
@data-entry-code, @external-reference |
Supported |
Success response
Returns 201 Created with the created activity definition in the response body.
Error responses
| Status code | Description |
|---|---|
| 400 | Bad request. Validation failed or the external reference is invalid. |
| 401 | Unauthorized. The bearer token is missing, expired, or invalid. |
Examples
Create basic activity definition
Example creating a basic activity definition:
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/1604fc20-8bf2-449f-83d9-1f3092283646/levels/2/activity-definitions
{
"name": {
"default": "Cleaning",
"translations": {
"nl": "Schoonmaken",
"fr": "Nettoyer"
}
},
"shortCode": "CL_001",
"dataEntryCode": "00025",
"externalReference": "Cleaning",
"info": "Cleaning the main building",
"activeFrom": "2025-01-01",
"activeUntil": "2026-01-01"
}Create activity definition with hierarchy
Example creating an activity definition with a parent hierarchy:
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/1604fc20-8bf2-449f-83d9-1f3092283646/levels/3/activity-definitions
{
"name": {
"default": "Cleaning",
"translations": {
"nl": "Schoonmaken",
"fr": "Nettoyer"
}
},
"parent": {
"id": "0b3642ae-16c9-4914-b099-2ba4b99d5ee9"
},
"shortCode": "CL_001",
"dataEntryCode": "00025",
"externalReference": "Cleaning",
"info": "Cleaning the main building",
"activeFrom": "2025-01-01",
"activeUntil": "2026-01-01"
}Create activity definition with external reference for parent
Example creating an activity definition using an external reference for the parent:
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/1604fc20-8bf2-449f-83d9-1f3092283646/levels/2/activity-definitions?externalReferences=(activity-definitions,@data-entry-code)
{
"name": {
"default": "Sales Activities",
"translations": {
"nl": "Verkoopactiviteiten",
"fr": "Activités de vente"
}
},
"parent": {
"externalReferences": {
"@data-entry-code": "10000"
}
},
"shortCode": "SA_001",
"dataEntryCode": "10001",
"externalReference": "SALES01",
"info": "All sales related activities",
"activeFrom": "2025-01-01"
}Create activity definition without end date
Example creating an activity definition without an end date:
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/activity-structure-versions/1604fc20-8bf2-449f-83d9-1f3092283646/levels/1/activity-definitions
{
"name": {
"default": "HR"
},
"shortCode": "HR",
"dataEntryCode": "2002",
"externalReference": "HR00002",
"info": "Human Resource department",
"activeFrom": "2025-01-01"
}