Quickstart
Run a whole charging session from the API with no hardware: start a virtual charger, plug in a car, start charging and read the energy back.
On this page
Run a complete charging session from your terminal, with no hardware and no site visit. You will start a virtual charger in your project's sandbox, plug a car into it, start charging with one API call and read the session back as it fills up.
Before you start
You need two things from the console:
An organization. Sign in and create one. It comes with a project called
prod, and you become its Owner.A sandbox API key. Switch the console to sandbox and create an API key that holds the Admin policy. Sandbox keys start with
flw_ak_test_. Copy the secret now: it is shown once.
Then set up your shell:
Everything in sandbox mode stays there. Nothing you do on this page reaches a live charger or a real invoice.
1. Find your project
Look up your organization by the slug you gave it, then list its projects:
Save the id as $ORG, then:
Save the id of the project with "isDefault": true as $PROJECT.
2. Start a virtual charger
Virtual chargers come from a catalogue of charger and car models:
Start a 22 kW three-phase AC charger:
200Response
Save id as $VC: it is how you act at the charger, as a driver would. Save chargingStationId as $CHARGER: it is the charger itself, the same record a physical charger has, and what the rest of the API works with.
3. Plug in a car
Park a 77 kWh car at outlet 1, with its battery at 20%:
4. Start charging from the API
This is the same call you would make to a real charger from your own app:
200Response
The command is on its way. Read it back with GET /charging-stations/$CHARGER/commands/{id} until status is accepted, which means the charger agreed to start.
5. Watch the session
200Response
energyWh appears once the charger has sent at least two meter readings, so give it a minute and ask again. To see the car's side of things, the battery level and the power it is drawing right now:
6. Stop charging
End the session at the charger, as a driver would:
List the charger's transactions again without ?status=open: the session now has an endedAt and a stoppedReason.
That is the whole loop: a charger comes online, a car plugs in, your app starts the charge, and the energy is recorded.
If a step fails
409 notSandboxMode. Your key is a live key. Virtual chargers live in sandbox, so use a key that starts withflw_ak_test_.409 chargerNotRunning. The virtual charger has switched itself off after an hour without activity. Switch it back on withPOST /virtual-chargers/$VC/start.409when starting a virtual charger. The project already has ten switched on, or the organization is at its sandbox limit. Switch one off or delete one.404on something you just created. Check the id, and that the key belongs to the same organization.
Next
Try a virtual charger: faults, dropped connections, paused cars and every other situation you can stage.
Start and stop sessions remotely: what your app can do with a session it starts.
Connect a charger: bring real hardware online.
Core concepts: how organizations, projects, locations and chargers fit together.