How OCPI works

Beginner

By Abhishek Uniyal · Updated

Step 4 of 6

An OCPI exchange has a request and a response. Platforms discover module URLs, then exchange charging data under their selected version.

Sources (4)
"The Open Charge Point Interface (OCPI) enables a scalable, automated EV roaming setup between Charge Point Operators and e-Mobility Service Providers."OCPI 2.1.1 specification · #introduction-and-backgroundALWAYS: Token always has to be whitelisted, realtime authorization is not possible/allowed. ALLOWED: It is allowed to whitelist the token, realtime authorization is also allowed. ALLOWED_OFFLINE: Whitelisting is only allowed when CPO cannot reach the eMSP (communication between CPO and eMSP is offline) NEVER: Whitelisting is forbidden, only realtime authorization is allowed. Token should always be authorized by the eMSP.OCPI 2.1.1 Tokens module · #44-whitelisttype-enum"The exact URL to the implemented version endpoint should be given (offline) to parties that interface with your OCPI implementation, this endpoint is the starting point for discovering locations of the different modules and versions of OCPI that have been implemented."OCPI 2.1.1 Version information endpoint chapter · #version-information-endpoint"Provides the server with credentials to access the client's system."OCPI 2.1.1 Credentials chapter · #12-post-method
What changes in OCPI 2.1.1
Modules in OCPI 2.1.1
Sessions
CDRs
Locations
Tariffs
Tokens
Commands
Credentials
Versions
No advertised interface-role field

Endpoint descriptions name the module and URL without an interface-role field.

The header carries the token value

The request header carries the shared credentials token value.

Session ID uses case-sensitive text

The Session ID uses text whose letter case matters.

How do the platforms exchange information?

One platform asks and the other answers. Here is the shape of one exchange between an eMSP and a CPO:

One exchange
eMSP

→

Asks for information

→

CPO
CPO

→

Sends the answer back

→

eMSP
What they exchange
Locations
Tariffs
Tokens
Sessions
CDRs
Commands

Must every card tap contact the eMSP?

The Token is the driver identification record. Its whitelist policy tells the CPO when it can authorize from its stored copy and when it must ask the eMSP in real time.

ALWAYS
Use the whitelist. Real-time authorization is not allowed.
ALLOWED
The CPO may choose stored authorization or a real-time request.
ALLOWED_OFFLINE
Whitelisting is allowed only when the CPO cannot reach the eMSP.
NEVER
Do not whitelist. Send a real-time authorization request for every use.
Sources (2)
"The Open Charge Point Interface (OCPI) enables a scalable, automated EV roaming setup between Charge Point Operators and e-Mobility Service Providers."OCPI 2.1.1 specification · #introduction-and-backgroundALWAYS: Token always has to be whitelisted, realtime authorization is not possible/allowed. ALLOWED: It is allowed to whitelist the token, realtime authorization is also allowed. ALLOWED_OFFLINE: Whitelisting is only allowed when CPO cannot reach the eMSP (communication between CPO and eMSP is offline) NEVER: Whitelisting is forbidden, only realtime authorization is allowed. Token should always be authorized by the eMSP.OCPI 2.1.1 Tokens module · #44-whitelisttype-enum

Does HTTP success mean OCPI success?

Read both layers of the response. HTTP is the transport status; the OCPI response body has its own status_code. OCPI 1000 is the generic success code. An HTTP success alone does not establish the OCPI result.

Teaching example · OCPI 2.1.1 response body excerpt

{
  "status_code": 1000
}
Sources (2)
"Response code, as listed in Status Codes, indicates how the request was handled. To avoid confusion with HTTP codes, at least four digits are used."OCPI 2.1.1 Transport and format chapter · #response-format1000: Generic success codeOCPI 2.1.1 Status codes chapter · #1xxx-success
One platform asks, the other answersEach module carries one kind of dataAuthorization follows the Token whitelist policy