TriReg2 User API

An OpenAPI specification for time registrations to be used by a user
More information: https://github.com/trifork/trireg2-api
Contact Info: example@example.com
Version: 0.2.0
BasePath:
MIT License
https://github.com/trifork/trireg2-api/LICENSE.md

Access

  1. HTTP Basic Authentication

Methods

[ Jump to Models ]

Table of Contents

Export

Import

KmRegistration

Login

Tag

TimeRegistration

Export

Up
post /export
(exportTimeRegistrationsForUser)
Exports time registrations for a specific time period for the user logged in

Query parameters

start (required)
Query Parameter — The start date of the export time interval (inclusive) default: null format: date
end (required)
Query Parameter — The end date of the export time interval (inclusive) default: null format: date

Return type

String

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK String

401

JWT is missing or invalid

502

While acting as a gateway or proxy, this service received an invalid response from the upstream server.

Import

Up
post /import
(importTimeRegistrations)
Imports the given time registrations into the system

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

ImportTimeRegistrationRequest_inner ImportTimeRegistrationRequest_inner (required)
Body Parameter

Return type

array[ImportTimeRegistrationResponse_inner]

Example data

Content-Type: application/json
[ {
  "timeRegistrationId" : 0,
  "message" : "message"
}, {
  "timeRegistrationId" : 0,
  "message" : "message"
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK

401

JWT is missing or invalid

502

While acting as a gateway or proxy, this service received an invalid response from the upstream server.

KmRegistration

Up
post /km-registration
(createKmRegistration)
Registers a new kilometre registration with to/from details and how many kilometres were travelled

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

KmRegistrationRequest KmRegistrationRequest (required)
Body Parameter

Return type

DefaultCreateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was created successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

201

Successfully created the kilometre registration DefaultCreateResponse

400

Bad create request String

401

JWT is missing or invalid

Up
delete /km-registration
(deleteKmRegistration)
Deletes or rejects a kilometre registration.

Query parameters

kmRegistrationId (required)
Query Parameter — The id of the kilometre registrations to update default: null format: int64

Return type

DefaultDeleteResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was deleted successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Successfully deleted or rejected a kilometre registration DefaultDeleteResponse

400

Bad delete request String

401

JWT is missing or invalid

404

Kilometre registration not found String

Up
get /km-registration
(getKmRegistrationsForUser)
Gets all kilometre registrations made by the specified user

Query parameters

userId (optional)
Query Parameter — The id of the user to get kilometre registrations data for default: null format: int64

Return type

array[KmRegistration]

Example data

Content-Type: application/json
[ {
  "date" : "2000-01-23",
  "kmRegistrationId" : 0,
  "km" : 1,
  "from" : "from",
  "to" : "to",
  "taskId" : 6
}, {
  "date" : "2000-01-23",
  "kmRegistrationId" : 0,
  "km" : 1,
  "from" : "from",
  "to" : "to",
  "taskId" : 6
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Successfully fetched the kilometre registrations

401

JWT is missing or invalid

404

User not found String

Up
put /km-registration
(updateKmRegistration)
Updates an existing kilometre registration with to/from details and how many kilometres were travelled

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

KmRegistrationUpdateRequest KmRegistrationUpdateRequest (required)
Body Parameter

Query parameters

kmRegistrationId (required)
Query Parameter — The id of the kilometre registrations to update default: null format: int64

Return type

DefaultUpdateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was updated successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Successfully updated the kilometre registration DefaultUpdateResponse

400

Bad update request String

401

JWT is missing or invalid

404

Kilometre registration not found String

Login

Up
get /login
(login)
Redirects to OpenId login flow. Only to be used when logging into the service through a web browser

Responses

302

Redirection to a login flow for the OpenId login provider. After completing the flow, the user will be redirected back to the application with a valid session token.

Tag

Up
delete /tag
(deleteTagRegistration)
Deletes a tag that was added to a time registration

Query parameters

tagId (required)
Query Parameter — The ID of the tag to delete default: null format: int64

Return type

DefaultDeleteResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was deleted successfully"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Tag was successfully deleted DefaultDeleteResponse

401

JWT is missing or invalid

404

The requested tag was not found and could not be deleted

Up
get /tag
(getTimeRegistrationTags)
Gets the tags associated with the specified time registration. This includes both the tags that have already been added, and the ones that can be added.

Query parameters

timeRegistrationId (required)
Query Parameter — The ID of the time registration to get tags for default: null format: int64

Return type

array[TimeRegistrationTag]

Example data

Content-Type: application/json
[ {
  "tagConfigurationMetadata" : {
    "tagConfigurationDescription" : "tagConfigurationDescription",
    "tagConfigurationId" : 5,
    "tagConfigurationName" : "tagConfigurationName",
    "valueType" : "STRING",
    "cardinality" : "OPTIONAL"
  },
  "tagValue" : {
    "tagId" : 2,
    "tagValue" : "tagValue"
  }
}, {
  "tagConfigurationMetadata" : {
    "tagConfigurationDescription" : "tagConfigurationDescription",
    "tagConfigurationId" : 5,
    "tagConfigurationName" : "tagConfigurationName",
    "valueType" : "STRING",
    "cardinality" : "OPTIONAL"
  },
  "tagValue" : {
    "tagId" : 2,
    "tagValue" : "tagValue"
  }
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

List of tags for the requested time registration, both existing and available to add

401

JWT is missing or invalid

404

Unable to find a time registration with the specified timeRegistrationId

502

While acting as a gateway or proxy, this service received an invalid response from the upstream server.

Up
post /tag
(tagTimeRegistration)
Tags a time registration with a specified tag and tag value

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

TagTimeRegistrationRequest TagTimeRegistrationRequest (required)
Body Parameter

Query parameters

timeRegistrationId (required)
Query Parameter — The ID of the time registration to add a tag to default: null format: int64

Return type

DefaultCreateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was created successfully"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Tag was successfully added to the time registration. The response contains the id of the new tag DefaultCreateResponse

401

JWT is missing or invalid

400

Tag was not added to the time registration due to an error with the request

404

No time registration was found to tag

502

While acting as a gateway or proxy, this service received an invalid response from the upstream server.

Up
put /tag
(updateTagRegistration)
Updates a tag that was added to a time registration

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

Tag Tag (required)
Body Parameter

Return type

DefaultUpdateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was updated successfully"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Tag was successfully updated DefaultUpdateResponse

400

The updated tag information yields an invalid tag

401

JWT is missing or invalid

404

The specified tag was not found

TimeRegistration

Up
post /time-registration/bulk
(addBulkTimeRegistrationForUser)
Add several time registrations for a user

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

TimeRegistrationRequest TimeRegistrationRequest (required)
Body Parameter

Return type

array[DefaultCreateResponse]

Example data

Content-Type: application/json
[ {
  "id" : 12345,
  "status" : "The data was created successfully"
}, {
  "id" : 12345,
  "status" : "The data was created successfully"
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

201

Time registrations added successfully

400

Failed creating one or more time registrations - if one time registration failed, no time registration is saved String

401

JWT is missing or invalid

Up
post /time-registration
(addTimeRegistrationForUser)
Adds a time registration for a user

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

TimeRegistrationRequest TimeRegistrationRequest (required)
Body Parameter

Return type

DefaultCreateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was created successfully"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

201

Time registration added successfully DefaultCreateResponse

401

JWT is missing or invalid

Up
post /time-registration/associate-task
(associateTimeRegistrationWithTask)
Associates a time registration - that currently does not have any task associated - to the specified task. Also accepts tags that may be required to make a valid time registration for the specified task.

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

TimeRegistrationAssociateTaskRequest TimeRegistrationAssociateTaskRequest (required)
Body Parameter

Return type

DefaultUpdateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was updated successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

associated DefaultUpdateResponse

400

Bad associate request String

401

JWT is missing or invalid

404

Time registration not found String

Up
delete /time-registration
(deleteTimeRegistration)
Deletes the specified time registration

Query parameters

timeRegistrationId (required)
Query Parameter — The id of the time registration to delete default: null format: int64

Return type

DefaultDeleteResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was deleted successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

deleted DefaultDeleteResponse

400

Bad delete request String

401

JWT is missing or invalid

404

Time registration not found String

Up
get /time-registration/active-task
(getTaskTimeRegistrationsOverview)
Returns time registrations for a user grouped by task

Query parameters

date (required)
Query Parameter — The date to consider when fetching active tasks and time registrations default: null format: date
period (optional)
Query Parameter — The time period to use when deciding in which time period tasks are considered active default: null

Return type

array[TimeRegistrationsByTaskResponse_inner]

Example data

Content-Type: application/json
[ {
  "taskDescription" : "taskDescription",
  "taskName" : "taskName",
  "timeRegistrations" : [ {
    "date" : "2000-01-23",
    "duration" : "PT1H30M",
    "timeRegistrationId" : 6,
    "registered" : 1,
    "description" : "description"
  }, {
    "date" : "2000-01-23",
    "duration" : "PT1H30M",
    "timeRegistrationId" : 6,
    "registered" : 1,
    "description" : "description"
  } ],
  "taskId" : 0
}, {
  "taskDescription" : "taskDescription",
  "taskName" : "taskName",
  "timeRegistrations" : [ {
    "date" : "2000-01-23",
    "duration" : "PT1H30M",
    "timeRegistrationId" : 6,
    "registered" : 1,
    "description" : "description"
  }, {
    "date" : "2000-01-23",
    "duration" : "PT1H30M",
    "timeRegistrationId" : 6,
    "registered" : 1,
    "description" : "description"
  } ],
  "taskId" : 0
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

List of time registrations for the user grouped by task

400

Request contains an invalid time period value String

401

JWT is missing or invalid

Up
get /time-registration
(getTimeRegistrationsForUser)
Returns time registrations that belongs to a user

Return type

array[TimeRegistrationResponse]

Example data

Content-Type: application/json
[ {
  "date" : "2000-01-23",
  "duration" : "PT1H30M",
  "timeRegistrationId" : 0,
  "registered" : 6,
  "description" : "description",
  "userId" : 1,
  "taskId" : 5,
  "tags" : [ {
    "tagConfigurationMetadata" : {
      "tagConfigurationDescription" : "tagConfigurationDescription",
      "tagConfigurationId" : 5,
      "tagConfigurationName" : "tagConfigurationName",
      "valueType" : "STRING",
      "cardinality" : "OPTIONAL"
    },
    "tagValue" : {
      "tagId" : 2,
      "tagValue" : "tagValue"
    }
  }, {
    "tagConfigurationMetadata" : {
      "tagConfigurationDescription" : "tagConfigurationDescription",
      "tagConfigurationId" : 5,
      "tagConfigurationName" : "tagConfigurationName",
      "valueType" : "STRING",
      "cardinality" : "OPTIONAL"
    },
    "tagValue" : {
      "tagId" : 2,
      "tagValue" : "tagValue"
    }
  } ]
}, {
  "date" : "2000-01-23",
  "duration" : "PT1H30M",
  "timeRegistrationId" : 0,
  "registered" : 6,
  "description" : "description",
  "userId" : 1,
  "taskId" : 5,
  "tags" : [ {
    "tagConfigurationMetadata" : {
      "tagConfigurationDescription" : "tagConfigurationDescription",
      "tagConfigurationId" : 5,
      "tagConfigurationName" : "tagConfigurationName",
      "valueType" : "STRING",
      "cardinality" : "OPTIONAL"
    },
    "tagValue" : {
      "tagId" : 2,
      "tagValue" : "tagValue"
    }
  }, {
    "tagConfigurationMetadata" : {
      "tagConfigurationDescription" : "tagConfigurationDescription",
      "tagConfigurationId" : 5,
      "tagConfigurationName" : "tagConfigurationName",
      "valueType" : "STRING",
      "cardinality" : "OPTIONAL"
    },
    "tagValue" : {
      "tagId" : 2,
      "tagValue" : "tagValue"
    }
  } ]
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

List of time registrations for the user

401

JWT is missing or invalid

Up
put /time-registration
(updateTimeRegistrationForUser)
Updates the specified time registration

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

TimeRegistrationUpdateRequest TimeRegistrationUpdateRequest (required)
Body Parameter

Query parameters

timeRegistrationId (required)
Query Parameter — The id of the time registration to update default: null format: int64

Return type

DefaultCreateResponse

Example data

Content-Type: application/json
{
  "id" : 12345,
  "status" : "The data was created successfully"
}

Example data

Content-Type: text/plain
Custom MIME type example not yet supported: text/plain

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Updated DefaultCreateResponse

400

Bad update request String

401

JWT is missing or invalid

404

Time registration not found String

Models

[ Jump to Methods ]

Table of Contents

  1. DefaultCreateResponse -
  2. DefaultDeleteResponse -
  3. DefaultUpdateResponse -
  4. ImportTimeRegistrationRequest_inner -
  5. ImportTimeRegistrationResponse_inner -
  6. ImportTimeRegistrationStatus -
  7. KmRegistration -
  8. KmRegistrationRequest -
  9. KmRegistrationStatus -
  10. KmRegistrationUpdateRequest -
  11. Tag -
  12. TagConfigurationMetadata -
  13. TagTimeRegistrationRequest -
  14. TimeRegistrationAssociateTaskRequest -
  15. TimeRegistrationRequest -
  16. TimeRegistrationResponse -
  17. TimeRegistrationStatus -
  18. TimeRegistrationTag -
  19. TimeRegistrationUpdateRequest -
  20. TimeRegistrationsByTaskResponse_inner -
  21. TimeRegistrationsByTaskResponse_inner_timeRegistrations_inner -

DefaultCreateResponse - Up

A response to a create operation.
id
Long The id of the created entity. format: int64
status
String A description of the status of the create operation.

DefaultDeleteResponse - Up

A response to a delete operation.
id
Long format: int64
status
String A description of the status of the delete operation.

DefaultUpdateResponse - Up

A response to an update operation.
id
Long The id of the updated entity. format: int64
status
String A description of the status of the update operation.

ImportTimeRegistrationRequest_inner - Up

userId
Long format: int64
taskId (optional)
Long Associates the time registration with a task. If not specified, then the description field must be a non-null value format: int64
date
date format: date
duration
String ISO 8601 formatted duration component <PnDTnHnMn.nS>. Each unit is optional, but at least one must be specified format: duration
tags
description (optional)

ImportTimeRegistrationResponse_inner - Up

timeRegistrationId
Long format: int64
status
message (optional)
String Provides a description of the import status

ImportTimeRegistrationStatus - Up

The status of importing a time registration Valid values: * VALID - The time registration is valid and has been imported successfully * PENDING - The time registration is valid, but is awaiting the approval of the user. Used when a user imports data for another user. * FAILED - Something is wrong with the time registration, it has not been imported.

KmRegistration - Up

kmRegistrationId
Long format: int64
taskId
Long format: int64
date
date format: date
from
to
km
status

KmRegistrationRequest - Up

taskId
Long format: int64
date
date format: date
from
to
km

KmRegistrationStatus - Up

Describes the status of the kilometre registration

KmRegistrationUpdateRequest - Up

date (optional)
date format: date
from (optional)
to (optional)
km (optional)
status (optional)
Enum:
APPROVE
REJECT
PENDING

Tag - Up

An existing tag with some value
tagId
Long The id of this tag format: int64
tagValue
String The value of this tag. This is a valid value corresponding to the tag configuration. For example, if the tag configuration specifies that the tag is an integer, then the value is a valid integer.

TagConfigurationMetadata - Up

Metadata for a tag configuration in the context of a specific time registration. This can differ based on the task the time registration is associated to, so a tag that is optional for one time registration can be mandatory for another.
tagConfigurationId
Long An identifier for this tag configuration format: int64
tagConfigurationName
String The name of the tag configuration
tagConfigurationDescription (optional)
String An optional description of the tag configuration
cardinality
String The status of a time registration Valid values: * OPTIONAL - The tag can be added to this time registration, but it is not required. * MANDATORY - The tag must be added to this time registration. * MANAGED - The tag is managed by administrator configuration. It is read-only and can't be changed.
Enum:
OPTIONAL
MANDATORY
MANAGED
valueType
String The value type of this configuration Valid values: * STRING - The tag value can be any string * BOOL - The tag value must be a boolean on the form 'true' or 'false' (case insensitive) * INT - The tag value must be a valid 32-bit integer
Enum:
STRING
BOOL
INT

TagTimeRegistrationRequest - Up

A request to set a tag value for a tag configuration for a time registration. Administrators configure the rules for tags for time registrations. This includes the format of the tag value, and whether tags are mandatory or optional. When setting a tag value for a time registration, the request must follow these rules.
tagConfigurationId
Long The id of the tag configuration to set a value for. This must be a valid tag configuration for the time registration. format: int64
value
String The value to set for the tag configuration. This is a string, but the format of the string is dependent on the tag configuration. For example, if the configuration specifies that the tag is an integer, then the string value must be a valid integer.

TimeRegistrationAssociateTaskRequest - Up

timeRegistrationId
Long format: int64
taskId
Long format: int64
tags

TimeRegistrationRequest - Up

taskId (optional)
Long Associates the time registration with a task. If not specified, then the description field must be a non-null value format: int64
date
date format: date
duration
String ISO 8601 formatted duration component <PnDTnHnMn.nS>. Each unit is optional, but at least one must be specified format: duration
tags (optional)
description (optional)

TimeRegistrationResponse - Up

timeRegistrationId
Long format: int64
registered
Long The registration time as Unix milliseconds timestamp format: int64
userId
Long format: int64
taskId (optional)
Long format: int64
date
date format: date
duration
String ISO 8601 formatted duration component <PnDTnHnMn.nS>. Each unit is optional, but at least one must be specified format: duration
status
tags
description (optional)

TimeRegistrationStatus - Up

The status of a time registration Valid values: * VALID - The time registration is valid * PENDING - The time registration is valid as such, but is awaiting the approval of the user. If this happens, it will become 'valid'. If it is rejected, it will become 'rejected'. * INVALID - Something is wrong with the time registration, it will need correction before it can become valid * DELETED - The time registration has existed at some point, but has now been deleted * REJECTED - The time registration has been rejected by the user

TimeRegistrationTag - Up

Composite object with information about a potential tag for a time registration. This consists both of tags that has been set, and tags that can potentially be set. Contains metadata describing the tag and the current tag value (if any). The 'tagValue' is null if no tag value has been set for the specific configuration.
tagConfigurationMetadata
tagValue (optional)

TimeRegistrationUpdateRequest - Up

date (optional)
date format: date
duration (optional)
String ISO 8601 formatted duration component <PnDTnHnMn.nS>. Each unit is optional, but at least one must be specified format: duration
status (optional)
description (optional)

TimeRegistrationsByTaskResponse_inner - Up

taskId (optional)
Long format: int64
taskName (optional)
taskDescription (optional)
timeRegistrations (optional)

TimeRegistrationsByTaskResponse_inner_timeRegistrations_inner - Up

timeRegistrationId
Long format: int64
registered
Long The registered time value as Unix milliseconds timestamp format: int64
date
date format: date
duration
String ISO 8601 formatted duration component <PnDTnHnMn.nS>. Each unit is optional, but at least one must be specified format: duration
status
description (optional)