Skip to the content.

Sites API

With Sites api V4 you can:

List sites

Fetch a paginated list of sites.

See the optional response fields.

Optional params:

examples:

Request

GET /api/v4/sites?team_id=26&updated_after=2022-05-24T19:30:30Z&orderby=updated_after+asc&fields=-id,-team_id,-boundaries,-info,-job_number,-address,-site_owner_id,-created_at

Response

200 OK
Accept-Ranges sites
Content-Range 0-1/2
[
  {
    "uuid": "1b14cac0-bd7f-11ed-9b4e-acde48001122",
    "location": "POINT (174.77604159462516 -41.286319623500816)",
    "name": "Doctor Jack-Jack",
    "site_owner_email": "tyson@ondricka.test",
    "site_owner_phone": "395.223.4525",
    "updated_at": "2023-01-19 13:11:00 +1300"
  },
  {
    "uuid": "1b14cac0-bd7f-11ed-9b4e-acde48001122",
    "location": "POINT (174.77604159462516 -41.286319623500816)",
    "name": "Doctor Jack-Jack",
    "site_owner_email": "luisa@kozey.example",
    "site_owner_phone": "(448) 993-8749",
    "updated_at": "2023-01-19 13:11:00 +1300"
  }
]

Create a site

Creates one site.

Input fields for create:

Request

POST /api/v4/sites
Content-Type application/json
{
  "site": {
    "uuid": "1b14cac0-bd7f-11ed-9b4e-acde48001122",
    "address": "Level 3/354 Lambton Quay, Wellington Central, Wellington 6011",
    "boundaries": "POLYGON ((174.7760662374219 -41.28628888757578, 174.77599163848276 -41.2863095461495, 174.77600806701338 -41.286352248914284, 174.77608819800787 -41.2863304566517, 174.7760662374219 -41.28628888757578))",
    "info": "Harum nihil non. Dolorem accusamus aut.\nRepudiandae suscipit perferendis. Nam iste aspernatur.",
    "job_number": "5af30ff1ce",
    "location": "Point (174.77604159462516 -41.286319623500816)",
    "name": "Doctor Jack-Jack",
    "site_owner_id": 35,
    "team_id": 26
  }
}

Response

201 Created
{
  "id": 1022,
  "uuid": "1b14cac0-bd7f-11ed-9b4e-acde48001122",
  "address": "Level 3/354 Lambton Quay, Wellington Central, Wellington 6011",
  "info": "Harum nihil non. Dolorem accusamus aut.\nRepudiandae suscipit perferendis. Nam iste aspernatur.",
  "job_number": "5af30ff1ce",
  "location": "POINT (174.77604159462516 -41.286319623500816)",
  "name": "Doctor Jack-Jack",
  "site_owner_id": 35,
  "site_owner_email": "dacia@rogahn.example",
  "site_owner_phone": "265.347.0733",
  "team_id": 26,
  "created_at": "2023-01-19 13:11:00 +1300",
  "updated_at": "2023-01-19 13:11:00 +1300"
}

Fetch a site

Get a site.

See the optional response fields.

Request

GET /api/v4/sites/1b14cac0-bd7f-11ed-9b4e-acde48001122?fields=boundaries

Response

200 OK
{
  "id": 1022,
  "uuid": "1b14cac0-bd7f-11ed-9b4e-acde48001122",
  "address": "Level 3/354 Lambton Quay, Wellington Central, Wellington 6011",
  "boundaries": "POLYGON ((174.7760662374219 -41.28628888757578, 174.77599163848276 -41.2863095461495, 174.77600806701338 -41.286352248914284, 174.77608819800787 -41.2863304566517, 174.7760662374219 -41.28628888757578))",
  "info": "Harum nihil non. Dolorem accusamus aut.\nRepudiandae suscipit perferendis. Nam iste aspernatur.",
  "job_number": "5af30ff1ce",
  "location": "POINT (174.77604159462516 -41.286319623500816)",
  "name": "Doctor Jack-Jack",
  "site_owner_id": 35,
  "site_owner_email": "hugh_koelpin@hahn-becker.test",
  "site_owner_phone": "967.196.1004",
  "team_id": 26,
  "created_at": "2023-01-19 13:11:00 +1300",
  "updated_at": "2023-01-19 13:11:00 +1300"
}

Update a Site

Updates the allowed fields on one single site. It only updates the fields sent.

Input fields for update:

Request

PATCH /api/v4/sites/123
Content-Type application/json
{
  "site": {
    "address": "Level 3/354 Lambton Quay, Wellington Central, Wellington 6011",
    "boundaries": "POLYGON ((174.7760662374219 -41.28628888757578, 174.77599163848276 -41.2863095461495, 174.77600806701338 -41.286352248914284, 174.77608819800787 -41.2863304566517, 174.7760662374219 -41.28628888757578))",
    "info": "Ullam eum odit. Sed nostrum quos. Enim quae ut.\nDolorem quae accusantium. In aut facere. Rerum dolor aut.",
    "job_number": "5af30ff1ce",
    "location": "Point (174.77604159462516 -41.286319623500816)",
    "name": "Doctor Jack-Jack",
    "site_owner_id": 35,
  }
}

Response

204 No Content

Request Site PDF

Produce the PDF file for the given Site ID in a background process.

The response for this request is an Async Job Resource with current status of the Background process. The background process status can be polled if you need to retrieve its conclusion status, result, link to download the file and eventual error messages.

Input fields for Request Site PDF:

Request

POST /api/v4/sites/123/export_item
Content-Type application/json
{
  "description": "Pong this ping to me",
}

Response

202 Accepted

{
  "id": 987123,
  "completed": false,
  "description": "Pong this ping to me",
  "success": null,
  "artifact_url": null,
  "result": null,
  "download_filename": null
}

Response fields

You can use the fields query parameter in any of the Site API endpoints to configure what fields will be included in the response. All fields in bold are included by default but you can opt-out of them using the - prefix.