Locations
Endpoints for managing locations.
GET Locations
Retrieve user locations.
- API
- SDK
GET /v2/hiven/users/:userId/locations
X-Api-Key: <apiKey>
X-User-Id: <userId>
Response
[
{
"id": "<string>",
"name": "<string>",
"coordinates": {
"latitude": "<number>",
"longitude": "<number>"
},
"countryCode": "<string>",
"postalCode": "<string>",
"streetAddress": "<string>",
"city": "<string>",
"spotPriceAreaId": "<string>",
"tariffInfo": {
"meterId": "<string>", // Optional
"tariff": "<string>", // Optional
"electricalUtilityProvider": "<string>" // Optional
} // Optional
}
]
client.getUserLocations(userId: string, options?: Options);
POST Location
Create new user location.
- API
- SDK
POST /v2/hiven/users/:userId/locations
X-Api-Key: <apiKey>
X-User-Id: <userId>
Payload
{
"name": "<string>",
"coordinates": {
"latitude": "<number>",
"longitude": "<number>"
}
"countryCode": "<string>",
"postalCode": "<string>",
"streetAddress": "<string>",
"city": "<string>",
"tariffInfo": {
"meterId": "<string>", // Optional
"tariff": "<string>", // Optional
"electricalUtilityProvider": "<string>" // Optional
} // Optional
}
Response
{
"id": "<string>",
"name": "<string>",
"coordinates": {
"latitude": "<number>",
"longitude": "<number>"
},
"countryCode": "<string>",
"postalCode": "<string>",
"streetAddress": "<string>",
"city": "<string>",
"spotPriceAreaId": "<string>",
"tariffInfo": {
"meterId": "<string>", // Optional
"tariff": "<string>", // Optional
"electricalUtilityProvider": "<string>" // Optional
} // Optional
}
client.setUserLocation(userId: string, payload: SetUserLocationPayload, options?: Options);
Important note: After updating location if spotPriceAreaId in the response has changed, make sure to update defaultSpotPriceAreaId for all devices of vehicle type.
PUT Location
Update existing user location.
Important note: Even though it is PUT, it acts as a PATCH allowing partial updates.
- API
- SDK
PUT /v2/hiven/users/:userId/locations/:locationId
X-Api-Key: <apiKey>
X-User-Id: <userId>
Payload
{
"name": "<string>", // Optional
"coordinates": {
"latitude": "<number>",
"longitude": "<number>"
} // Optional
"countryCode": "<string>", // Optional
"postalCode": "<string>", // Optional
"streetAddress": "<string>", // Optional
"city": "<string>", // Optional
"tariffInfo": {
"meterId": "<string>", // Optional
"tariff": "<string>", // Optional
"electricalUtilityProvider": "<string>" // Optional
} // Optional
}
Response
{
"id": "<string>",
"name": "<string>",
"coordinates": {
"latitude": "<number>",
"longitude": "<number>"
},
"countryCode": "<string>",
"postalCode": "<string>",
"streetAddress": "<string>",
"city": "<string>",
"spotPriceAreaId": "<string>",
"tariffInfo": {
"meterId": "<string>", // Optional
"tariff": "<string>", // Optional
"electricalUtilityProvider": "<string>" // Optional
} // Optional
}
client.updateUserLocation(userId: string, locationId: string, payload: UpdateUserLocationPayload, options?: Options);
DELETE Location
Delete existing user location.