Nápověda

First request

This walkthrough retrieves the first five assets available to your service account in a tenant.

Before you begin, obtain:

  • A client ID and client secret issued by OLIFY
  • A tenant GUID issued with those credentials
  • An access token from the authentication flow

1. Set the request values

Store the access token and tenant GUID in environment variables for the example:

export ACCESS_TOKEN='YOUR_ACCESS_TOKEN'
export TENANT_ID='11111111-1111-1111-1111-111111111111'

2. List assets

Send GET /assets with the Bearer token, tenant header, and JSON media type. This request selects three properties, limits the result to five records, and asks for the total number of matching assets.

GET https://api.olify.io/assets?$top=5&$count=true&$select=id,code,name
Authorization: Bearer {access_token}
Olify-Tenant-Id: {tenant_id}
Accept: application/json
curl -sS -G 'https://api.olify.io/assets' \
  --data-urlencode '$top=5' \
  --data-urlencode '$count=true' \
  --data-urlencode '$select=id,code,name' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Olify-Tenant-Id: $TENANT_ID" \
  -H 'Accept: application/json'

3. Read the response

A successful list request returns a JSON object with a value array. Because the request includes $count=true, it also returns count:

{
  "value": [
    {
      "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "code": "AHU-01",
      "name": "Air handling unit"
    }
  ],
  "count": 1
}

count is the total number of matching records before $top and $skip are applied. The OLIFY API does not return this value as @odata.count. If $count is omitted, the response contains only value.

JSON property names are camelCase, enum values are strings, and timestamps are ISO-8601 instants.

Retrieve an individual asset

Use an asset UUID from the list response with GET /assets/{id}:

GET https://api.olify.io/assets/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
Authorization: Bearer {access_token}
Olify-Tenant-Id: {tenant_id}
Accept: application/json

Continue with other operations

Other operations use the same authentication and tenant headers. Create requests require a client-generated UUID in the JSON id property. Send JSON request bodies with Content-Type: application/json. Successful POST, PUT, and DELETE requests typically return HTTP 200 with an empty body; follow the write with GET /{id} when you need the stored record.

Review Filter & sort for OData query options and Errors for failure handling. The sidebar Operations section documents each HTTP operation.

Na této stránce