activities API

Follow

Summary

Requirements

All API calls require a dedicated JSON Web Token (JWT). These are created when a user with a dedicated mobile resource logs in to the application. If you are using the API for programmatic queries, it is best to create a dedicated user for the JWT as this gets reset each time the user logs in.

Endpoint

/rest/activities/

GET

Returns details for a single activity or an array of activities depending on the format of the URL. Up to 20 activity IDs can be passed in a single call.

Single Activity

Example URL

/rest/activities/137121

Multiple Activities

Example URL

/rest/activities?ids=137121,137120

Response Format Spec

 

Response Fields
Field Name Data Type Description
assetId Integer The ID of the asset against which the activity is loaded
completedQuantity Decimal The completed quantity of the activity
duration Integer The duration of the activity
description Text (1000) The description of the activity
id Integer The ID of the activity
isDeleted True/False Whether the activity is deleted or not
jobId Integer The ID of the job in Oneserve
lastModified DateTime The date/time at which the activity was last modified
libraryActivityId Integer The ID of the associated library activity
quantity Decimal The quantity of the activity on the job
serviceId Integer The ID of the service
siteLocationId Integer The ID of the site location against which the activity is loaded
status Integer (1-4) 1 - PENDING
2 - APPROVED
3 - REJECTED
4 - DELETED
supplierId Integer The ID of the team assigned to the activity
resourceId Integer The ID of the resource assigned to the activity
ref Text (200) The reference of the activity
activityCategoryId Integer The ID of the activity category

 

Available Response Representations

HTTP Code Description Schema
200 Document Information Document information
400 Bad Request Error
401 Unauthorized Error
403 Forbidden Error
404 Address Not Found Error
405 Method Not Allowed Error
500 Internal Server Error Error

 

Example Success Response
{
    "activities": [
        {
            "completedQuantity": "0.00000",
            "description": "",
            "duration": 30,
            "id": 137120,
            "isDeleted": false,
            "jobId": 63135,
            "lastModified": "2020-07-11T20:00:08.157Z",
            "libraryActivityId": 16429,
            "quantity": "1.00000",
            "serviceId": 297,
            "status": 2,
            "supplierId": 1193
        },
        {
            "assetId": 1026,
            "completedQuantity": "0.00000",
            "duration": 30,
            "id": 137121,
            "isDeleted": false,
            "jobId": 63136,
            "lastModified": "2020-07-12T18:03:47.913Z",
            "libraryActivityId": 2205,
            "quantity": "1.00000",
            "serviceId": 62,
            "siteLocationId": 933,
            "status": 2,
            "supplierId": 147
        }
    ]
}

 

Troubleshooting

 

401 Unauthorized

Response

401 Unauthorized

Reason

This error occurs if the OS_REST_AUTH_TOKEN has not been provided, has expired, or does not exist in the system

Resolution

Verify your OS_REST_AUTH_TOKEN with support

403 Forbidden

Response

403 Forbidden

Reason

This error indicates that something is blocking your connection to the server

Resolution

Open a ticket with the support team with details of your connection so that your access can be verfied

404 Not Found

Response

404 Not Found

Reason

This error could occur if the endpoint is not entered correctly or a non-existent client ID is passed in the request

Resolution

Verify the endpoint matches the value specified in this article. Check that the client ID exists in your Oneserve system.

405 Method Not Allowed

Response

405 Method Not Allowed

Reason

This error will occur if an unacceptable method has been used in the call such as POST or DELETE

Resolution

Ensure that you are using a GET call to this endpoint