Tovább a tartalomhoz

Simple API requests

Ez a tartalom még nem érhető el a jelenlegi nyelven.

Use this tutorial to make one authenticated request, inspect the list response, and request one charger using an ID returned by the list.

Create an API key authorized for the organization you will query, and obtain that organization’s ID. Keep the key in a secret manager or environment variable; do not commit it to source control. See Selecting an organization for how to scope requests.

Terminal window
API_BASE='https://api.cleverev.net'
API_KEY='replace-with-your-api-key'
ORGANIZATION_ID='replace-with-your-organization-id'
COMPATIBILITY_DATE='2026-01-01'

COMPATIBILITY_DATE must use YYYY-MM-DD and be later than 2025-11-01.

Terminal window
curl --get "$API_BASE/chargers" \
--data-urlencode 'page=1' \
--data-urlencode 'per_page=10' \
--header "Authorization: Bearer $API_KEY" \
--header "organization-id: $ORGANIZATION_ID" \
--header "compatibility-date: $COMPATIBILITY_DATE" \
--header 'Accept: application/json'

page=1 and per_page=10 are the defaults; they are explicit here to make the pagination inputs visible. A successful response contains chargers and total. An empty chargers array is a valid result; check that the key and organization scope point to the intended account before treating it as an error.

Copy an id from an item in chargers and use it in the path:

Terminal window
CHARGER_ID='copy-id-from-the-list-response'
curl "$API_BASE/chargers/$CHARGER_ID" \
--header "Authorization: Bearer $API_KEY" \
--header "organization-id: $ORGANIZATION_ID" \
--header "compatibility-date: $COMPATIBILITY_DATE" \
--header 'Accept: application/json'

For more complex list queries, see Filtering, sorting and pagination.