Skip to content

Retrieve the latest value

Request

Security
oauth2
Path
twinIdstringrequired

Id of the twin

Example:TW-DD-II-01
Query
startstring, (date-time)

Start timestamp for the request

Example:start=2024-10-01T00:00:00Z
endstring, (date-time)

End timestamp for the request

Example:end=2024-10-07T00:00:00Z
includeDataQualityboolean

If true, include data quality metrics in the response

Example:includeDataQuality=false
const query = new URLSearchParams({
  start: '2024-10-01T00:00:00Z',
  end: '2024-10-07T00:00:00Z',
  includeDataQuality: 'false'
}).toString();

const twinId = 'TW-DD-II-01';
const instance = 'YOUR_instance_PARAMETER';
const resp = await fetch(
  `https://${instance}.app.willowinc.com/api/v3/time-series/${twinId}/latest?${query}`,
  {
    method: 'GET',
    headers: {
      Authorization: 'Bearer <YOUR_TOKEN_HERE>'
    }
  }
);

const data = await resp.text();
console.log(data);

Responses

OK

Bodyapplication/json
Array [
connectorIdnull or string

Id of the connector

twinIdnull or string

Id of the twin

externalIdnull or string

External Id of the twin

sourceTimestampstring, (date-time)

Timestamp when the source recorded the value in ISO 8601 format

enqueuedTimestampstring, (date-time)

Timestamp when Willow received the value in ISO 8601 format

scalarValue(null or number) or (null or string) or (null or boolean) or (null or integer)
One of:

The data value being trended

null or number
propertiesobject

Properties or metadata about the observation or event being trended.

dataQualityobject or DataQuality (object)
One of:

Data quality information.

]
Response
[ { "connectorId": "TW-CC-01", "twinId": "TW-DD-II-01", "externalId": "PNTC4Jm8vXy7bWq9rT5sHkLz2p", "sourceTimestamp": "2024-10-01T12:34:56Z", "enqueuedTimestamp": "2024-10-01T12:35:00Z", "scalarValue": 42, "properties": { … }, "dataQuality": { … } } ]