Quickstart Guide for ChargEye REST API
Kempower ChargEye provides a comprehensive REST API to programatically 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. We hope this guide helps you get started with the ChargEye API.
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, have your organization admin user visit the Account Administration view in ChargEye where the API Refresh token can be created.
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",
"country": "1",
"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 limit on the number of requests you can make.
API Reference
You will find the available APIs on the left side menu.
"Try it" console
There is an orange Try it button next to every operation in the API documentation. It can be used to play around with the API from the comfort of your web browser.
Click on it, and expand the Security pane to log in with your ChargEye credentials, to automatically fill in the Authorization token for API calls.
After logging in, simply click Send.
Try it console
Login button