Trenchline Elenti API

The Trenchline Jobs API allows you to take complete control of your jobs. You can control all entities within the object, generate file links, create jobs and more. We've tried to cater to every possible use case.

Each API request counts against your total monthly quota. We do this because we want to give you the flexibility to use our API how you wish, and we want to ensure it's sustainable without us having to increase server requirements for third parties.

If there's anything you think we should add, please let us know at dev@kpit.co.uk.

Authentication

To connect to our API, you must use the Authorization header. This can be obtained by emailing us at dev@kpit.co.uk. Your API key has complete access to your account, so please protect it.

GET Request
curl https://trenchline-intranet.kpitservices.co.uk/api/v1/account/ \
-H "Authorization: Bearer API_TOKEN_HERE"
Response
{
    "id": 1923,
    "name": "Traffic Lights Ltd",
    "email": "support@trafficlightslimited.com",
    "created": "2022-02-01 13:05:00"
}

Listing all jobs on your account

To list all jobs, you simply need to send a GET request to https://trenchline-intranet.kpitservices.co.uk/api/v1/jobs/list/ and the server will return an array with all jobs created under your client ID.

GET Request
curl https://trenchline-intranet.kpitservices.co.uk/api/v1/jobs/list/ \
-H "Authorization: Bearer API_TOKEN_HERE"
Response
{
    "count": 1,
    "data": {
        "jobs": [{
            "reference": "000000TL",
            "client_reference": "AAA-0000",
            "address": "Test Road, Test Town",
            "status": "Complete",
            "description": "This is an example job",
            "traffic_management_required": 1,
            "date_created": "2020-12-01 13:00:00",
            "date_start": "2020-12-08",
            "date_end": "2020-12-16",
            "latitude": "50.8000000000000",
            "longitude": "0.3000000000000",
            "archived": 0
        }]
    }
}

Retrieve a single job from your account

To retrieve a single job from your account you'll need either the internal Trenchline reference or the client reference she used when creating a job. Make a GET request and include the reference and the server will return an array with all jobs created under your client ID.


GET paramters:

reference => Internal Trenchline reference or your client reference

GET Request
curl https://trenchline-intranet.kpitservices.co.uk/api/v1/jobs/single?reference=00000TL \
-H "Authorization: Bearer API_TOKEN_HERE"
Response
{
    "job": [
        "reference": "00000TL",
        "client_reference": "AAA-0000",
        "address": "Test Road, Test Town",
        "status": "Complete",
        "description": "This is an example job",
        "traffic_management_required": 1,
        "date_created": "2020-12-01 13:00:00",
        "date_start": "2020-12-08",
        "date_end": "2020-12-16",
        "latitude": "50.8000000000000",
        "longitude": "0.3000000000000",
        "archived": 0
    }
}

Listing all files linked to a job

When a file is uploaded either by an admin or an engineer, it is a linked to the internal Trenchline job reference. To list these jobs, you'll first need to call the 'List a single job' endpoint to retrieve the Trenchline job reference, if you don't have it already. Then you can simply call the endpoint and all files will be listed in an array.


GET paramters:

reference => Internal Trenchline reference

GET Request
curl https://trenchline-intranet.kpitservices.co.uk/api/v1/jobs/files?reference=00000TL \
-H "Authorization: Bearer API_TOKEN_HERE"
Response
{
    "count": 2,
    "data": {
        "files": [{
            "reference": "0000000000",
            "name": "Test File 1.pdf",
            "special": "Required:FILE_AMENDED",
            "catagory": "Default File",
            "created": "2022-01-06 12:30:00"
        }, {
            "reference": "0000000000",
            "name": "Test File 2.pdf",
            "special": null,
            "catagory": "STAT Plan",
            "created": "2022-01-06 13:00:00"
        }
    }
}