Get asset actuals
Base URL: https://api.tensorenergy.jp/v1
Path: /actuals/{ASSET_ID}
Method: GET
Query parameters
Field | Type | Description | Required |
---|---|---|---|
from | string | Starting time for the interval to retrieve actuals from, expressed in the following format: 2006-01-02T15:04:05Z | true |
to | string | Ending time for the interval to retrieve actuals to, expressed in the following format: 2006-01-02T15:04:05Z | true |
source | metering | iot | monitoring | Desired source of actuals. If the parameter is not provided, the query will default to meter data, if meter data does not exist, will fallback to monitoring data. | false |
Response
The response is an non-nullable JSON object with the following fields:
Field | Type | Description |
---|---|---|
data | [AssetActualSet] | null | Returned data from the query. If error is non-null, then this value will be null. |
error | Error | null | Any error returned from the query. If data is non-null, then this value will be null. |
AssetActualSet Object
Field | Type | Description |
---|---|---|
datetime | string | Timestamp of the actuals, expressed as an ISO 8601 compliant UTC timestamp. |
value | float | Amount of energy generation, expressed in kilowatt hour (kWh). |
Error object
Field | Type | Description |
---|---|---|
message | string | Message that explains what went wrong. |
code | internal_server_error | not_authorized | invalid_query_parameter | resource_not_found | Error code that occurred. |
Example request
- cURL
- Python
- Typescript
curl --request GET \
--url https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3?from=2006-01-02T15:04:05Z&to=2006-01-02T15:04:05Z \
--header "authorization: Bearer ${API_TOKEN}"
import requests
API_URL = 'https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3?from=2006-01-02T15:04:05Z&to=2006-01-02T15:04:05Z'
API_TOKEN = 'YOUR_API_KEY'
headers = {
'authorization': f'Bearer {API_TOKEN}',
}
response = requests.get(API_URL, headers=headers)
print(response.json())
const API_URL = 'https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3?from=2006-01-02T15:04:05Z&to=2006-01-02T15:04:05Z'
const API_TOKEN = 'YOUR_API_KEY'
const fetchData = async () => {
try {
const response = await fetch(API_URL, {
method: 'GET',
headers: {
'authorization': `Bearer ${API_TOKEN}`
}
})
console.log(response)
} catch (error) {
console.error(error)
}
};
fetchData()
Example responses
Asset exists and no error occurs
{
"data": [
{
"datetime": "2024-01-01T00:00:00Z",
"value": 9.812
},
{
"datetime": "2024-01-01T00:30:00Z",
"value": 10.1
},
{
"datetime": "2024-01-01T01:00:00Z",
"value": 10.891
}
],
"error": null
}
Error occurs during operation
{
"data": null,
"error": {
"message": "something went wrong during the process",
"code": "internal_server_error"
}
}
No actuals exists for the asset
{
"data": [],
"error": null
}