Add asset actuals
Base URL: https://api.tensorenergy.jp/v1
Path: /actuals/{ASSET_ID}
Method: POST
Query parameters
This API does not require any query parameters.
Body
The request body is expected to provide the following fields:
Field | Type | Description |
---|---|---|
source | meter_confirmed | meter_preliminary | meter_preliminary_high_voltage | meter_preliminary_low_voltage | monitoring_generic | monitoring_laplace | The source of the asset actual data. |
unit | kw | kwh | The unit the asset actual data is in. |
data | [AssetActualSet] | The asset actual data. |
Response
The response is an non-nullable JSON object with the following fields:
Field | Type | Description |
---|---|---|
success | boolean | Flag that indicates if the mutation succeeded or not. |
data | [AssetActualSet] | null | The Asset actuals that were added. If success = false, this value will be null. |
error | Error | null | Any error returned from the query. If success = true, this value will be null. |
AssetActualSet Object
Field | Type | Description |
---|---|---|
datetime | string | Timestamp of the actuals, expressed as an ISO 8601 compliant UTC timestamp. This is expected to be half hour intervals. Ex. 2021-01-01T00:30:00Z or 2021-01-01T01:00:00. |
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_payload | resource_not_found | Error code that occurred. |
Example request
- cURL
- Python
- Typescript
curl --request POST \
--url https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3 \
--header "authorization: Bearer ${API_TOKEN}"
--header 'Content-Type: application/json'
--data '{"source": "meter_confirmed", "unit": "kwh", "data":[{"datetime": "2022-01-01T00:00:00Z, "value": 9.12}, {"datetime": "2022-01-01T00:30:00Z, "value": 15.12},{"datetime": "2022-01-01T01:00:00Z, "value": 19.123}]}'
import requests
API_URL = 'https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3'
API_TOKEN = 'YOUR_API_KEY'
headers = {
'authorization': f'Bearer {API_TOKEN}',
}
body = {
'source': 'meter_confirmed',
'unit': 'kwh',
'data': [
{
'datetime': '2022-01-01T00:00:00Z',
'value': 9.12
},
{
'datetime': '2022-01-01T00:30:00Z',
'value': 15.12
},
{
'datetime': '2022-01-01T01:00:00Z',
'value': 19.123
},
]
}
response = requests.post(API_URL, headers=headers, json=body)
print(response.json())
const API_URL = 'https://api.tensorenergy.jp/v1/actuals/51d5ffcf-1347-4277-93e8-dfca140fe8b3'
const API_TOKEN = 'YOUR_API_KEY'
const payload = {
source: 'meter_confirmed',
unit: 'kwh',
data: [
{
datetime: '2022-01-01T00:00:00Z',
value: 9.12
},
{
datetime: '2022-01-01T00:30:00Z',
value: 15.12
},
{
datetime: '2022-01-01T01:00:00Z',
value: 19.123
},
]
}
const fetchData = async () => {
try {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'authorization': `Bearer ${API_TOKEN}`
},
body: JSON.stringify(payload)
})
console.log(response)
} catch (error) {
console.error(error)
}
};
fetchData()
Example responses
Added asset actuals
{
"success": true,
"data": [
{
"datetime": "2022-01-01T00:00:00Z",
"value": 9.12
},
{
"datetime": "2022-01-01T00:30:00Z",
"value": 15.12
},
{
"datetime": "2022-01-01T01:00:00Z",
"value": 19.123
},
],
"error": null
}
Error occurs during operation
{
"success": false,
"data": null,
"error": {
"message": "something went wrong during the process",
"code": "internal_server_error"
}
}