APIs/Energy API
APIs/Energy API

Details

Application

To use this API, you must first create an application. When your application is created, you will receive a VCC API key. This key must be included in the header of each request sent to the API.

Visit your account page to create or view applications.

Example

-H 'vcc-api-key: <your-vcc-api-key>'

Authorisation

This API uses the OAuth2 framework. An access token must be included in the header of each request sent to the API.

Visit the authorisation page for more information.

Example

-H 'authorization: Bearer <your-access-token>'

Status codes

Status CodeDescription

Status Code

200 OK

Description

Successful request.

Status Code

202 Accepted

Description

Successful request, but the processing has not been completed.

Status Code

204 No Content

Description

Successful request, but the response will not contain a body.

Status Code

400 Bad Request

Description

The update did not pass the validation rules defined in the Open API spec or an invalid json payload was sent.

Status Code

401 Unauthorized

Description

Usually an indication of an error with either the VCC-API-key or Bearer token, check the error message for details.

Status Code

404 Not found

Description

The resource could not be found, the description can contain a reason for the response.

Status Code

406 Not Acceptable

Description

An invalid mediatype was sent in the Accept header.

Status Code

409 Conflict

Description

A request conflict with the current state of the target resource.

Status Code

422 Unprocessable Entity

Description

The update passes the validation rules defined in the Open API spec but fails against the internal business rules.

Status Code

500 Internal Server Error

Description

Something went wrong when processing the request, check the error message for details.

Status Code

502 Bad Gateway

Description

Something went wrong when trying to reach the API.

Error handling

Sometimes things go wrong, in such cases the API will in addition to the HTTP error code return a message body containing information about the error. The message body has a base structure which will be the same regardless of the error:

FieldDescription

Field

code

Description

The HTTP status codes.

Field

message

Description

A message explaining the error.

Field

details

Description

A list of more detailed descriptions of the error(s) or an empty list.

Example

{
    "code": "INTERNAL_ERROR",
    "message": "An internal error occurred. Ref: c3140d113932b5f7c6549a48a647b52a",
    "details": []
}
{
    "code": "REQUEST_VALIDATION_FAILED",
    "message": "Request validation failed, see details",
    "details": [
        {
            "code": "CHARGING_SCHEDULE_KIND_NOT_SUPPORTED",
            "message": "The provided charging schedule kind is not supported for this vehicle"
        }
    ]
}

Debugging errors

If the error message from the request body doesn't provide enough information for troubleshooting, you can contact us at developer.portal@volvocars.com.

Before contacting us, please include the vcc-api-operationId trace header or the internal error reference nuber of the problematic API request. This will help us locate your requests in our systems.

Please note that an incoming vcc-api-operationId header will be forwarded as a response header and must be formatted as a UUID.

Example

-H 'vcc-api-operationId: <UUID>'

/