Guest organisation
OCPI
Learn reference
Guest organisation
OCPI
Learn reference

Charge and update the Session

By Abhishek Uniyal · Updated

Step 9 of 11

OCPI 2.2.1

Compare versions

A Session update carries changes to the charging record. This local example adds simulated energy readings and illustrates a CPO update to the eMSP.

What changes in OCPI 2.2.1
Modules in OCPI 2.2.1
Sessions
CDRs
Locations
Tariffs
Tokens
Commands
Credentials
Versions
Hub Client Info
Charging Profiles
Payments · extension
Advertised sender and receiver interfaces

An endpoint declares how another platform can pull or push data. Credentials uses the same interface for both roles.

The header token is encoded

The request header carries an encoded token; the Credentials body still carries the raw token.

Billing records name the Token owner

A charge record names the country and company that own the driver's Token.

Simulated copies · no peer is connected

CPO

Session ACTIVE, 0.00 kWh delivered.

eMSP

Session ACTIVE, 0.00 kWh from the CPO's latest update.

0 seconds elapsed

Which OCPI exchange does this action illustrate?

In OCPI 2.2.1 and 2.3.0 the CPO sends every change to a Session it already pushed by calling PATCH on the eMSP's Sessions endpoint. Only the fields that need to be updated have to be present, and any field it does not specify is considered unchanged. Every PATCH request SHALL contain last_updated.

Teaching example · request path

PATCH /sessions/{country_code}/{party_id}/{session_id}
Sources (3)
"Any changes to a Session in the CPO system are sent to the eMSP system by calling PATCH on the eMSP's Sessions endpoint with the updated Session object."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"Same as the PUT method, but only the fields/objects that need to be updated have to be present. Fields/objects which are not specified are considered unchanged."OCPI 2.2.1 Sessions module · #mod_sessions_patch_method"Any request to the PATCH method SHALL contain the `last_updated` field."OCPI 2.2.1 Sessions module · #mod_sessions_patch_method

A Session records state, including ACTIVE before any energy has been transferred. The completed charge detail record supports billing; this example does not show a customer debit.

Sources (2)
ACTIVE: The session has been accepted and is active. All pre-conditions were met: Communication between EV and EVSE (for example: cable plugged in correctly), EV or driver is authorized. EV is being charged, or can be charged. Energy is, or is not, being transfered.OCPI 2.2.1 Sessions module · #mod_sessions_sessionstatus_enum"A *Charge Detail Record* is the description of a concluded charging session. The CDR is the only billing-relevant object."OCPI 2.2.1 CDRs module · #mod_cdrs_cdrs_module
Session definition · Read the Sessions reference