Quickstart Guide for ChargEye REST API
Kempower ChargEye provides a comprehensive REST API to programmatically access any data, and to perform any operation.
This guide provides an overview of ChargEye REST API, including how to authenticate, make API calls, and handle errors.
If you have any questions, please contact Kempower support team at support@kempower.com.
Authentication
Authentication for ChargEye API is based on JSON Web Tokens (JWTs). To obtain a JWT, you'll need to provide a refresh token, which can be obtained through ChargEye authentication service.
To get a new JWT, make an HTTP request to the following endpoint with your refresh token in the request body:
GET https://kempower.io/api/auth/refreshAccessToken
Authorization: Bearer your-refresh-token
If the request is successful, you'll receive a response that includes a JWT and its expiration time:
{
"token": "your-jwt-token",
"validUntil": "2021-03-29T14:35:01.000Z"
}
The JWT is valid for 8 hours (28800 seconds) from the time it was issued. The token should be cached within your system so you don't have to call the authentication endpoint before every API call.
To refresh the token, simply make another GET request to the same endpoint with the same refresh token. The new JWT will have a new expiration time.
Obtaining a Refresh Token
Your refresh token is a secret key that should be kept confidential. To obtain a refresh token, please contact customer support via https://kempower.com/support/.
Tooling
To help you get started with ChargEye API, we provide an OpenAPI definition for every part of the API. The definition file can be used to generate an API client for your programming language. Please refer to the tooling of your programming environment.
Example REST API Call
Here's an example of how to make a GET request to retrieve a list of locations from the API:
GET https://kempower.io/api/locations
Authorization: Bearer your-jwt-token
If the request is successful, you'll receive a response with the requested data:
{
"locations": [
{
"country": "Finland",
"city": "Helsinki",
"address": "Mannerheimintie 1",
"id": "LF59aGkk2t",
"name": "Acme Inc Manner Parking Lot"
}
]
}
Error Handling
ChargEye API returns standard HTTP status codes for errors. Here are some common codes:
- 400 Bad Request: Invalid request parameters
- 401 Unauthorized: Invalid or expired JWT token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Resource not found
- 500 Internal Server Error: Error handling the request, please contact Kempower support
Error responses include a JSON payload with a message explaining the error:
{
"errorMessage": "Invalid request parameters"
}
Limits and Throttling
There are presently no limits on the number of requests you can make.
API Reference
Browse the available APIs from the homepage.
"Try it" Console
Each API reference page includes an interactive "Try it" panel. You can use it to make real API requests directly from the documentation.
Expand the Authentication section, enter your JWT token, and click Send to test any endpoint.