Skip to main content

Start a reservation

Description#

This endpoint is used to initiate a remote reservation.

If you want to know more about the remote reservation workflow, take a look to this guide.

Request format#

Method: POST

Endpoint: https://dev.api.thor.tools/latest/integration/charges/reservenow

Body format: JSON

KeyTypeDescription
chargeboxStringThe unique chargebox identifier.
connectorIntegerThe connector where you want to start the reservation.
stripe_tokenStringThe Token of the reservation generated by stripe.
userStringThe unique ID of the user that call the action.
expiry_dateIntegerThe time in ms epoch format of the date of reservation expiration you want to set.

Request schema:

{
"$schema": "http://json-schema.org/draft-04/schema",
"id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"required": [
"chargebox",
"connector",
"expiry_date"
],
"properties": {
"chargebox": {
"id": "http://example.com/properties/chargebox",
"type": "string",
"title": "The chargebox schema",
"description": "The chargebox identifier.",
"default": ""
},
"connector": {
"id": "http://example.com/properties/connector",
"type": "integer",
"title": "The connector schema",
"description": "The connector where you want to start the transaction.",
"default": 0
},
"stripe_token": {
"id": "http://example.com/properties/stripe_token",
"type": "string",
"title": "The stripe_token schema",
"description": "The Token generated by Stripe about the transaction.",
"default": 0,
"examples": [
"pi_dygforfgyireogfr"
]
},
"user": {
"id": "http://example.com/properties/user",
"type": "string",
"title": "The user schema",
"description": "The User requested the reservation.",
"default": 0,
"examples": [
"001",
"009",
"08787"
]
},
"expiry_date": {
"id": "http://example.com/properties/expiry_date",
"type": "integer",
"title": "The expiry_date schema",
"description": "The time in ms epoch format for expiration.",
"default": 0,
"examples": [
12343234543
]
},
},
"additionalProperties": true
}

Response format#

The response is a JSON containing the following fields:

Field nameTypeDescription
id_tagStringThe identifier that the chargebox must use to start a transaction after a reservation.
reservationReservation(if available for client) The settings of the payment reservation choosen by client to add reservation to total price

A succesful response is returned with an HTTP status code 200 - OK

Example response#

{
"id_tag": "173e7b23d0egv0yjtc4q",
"reservation: {
"notice": 60,
"amount": 0.5
}
}

Error response#

The following errors are returned if something went wrong while processing the request:

HTTP status codeMessageDescription
400ConnectorNotValidThe connector value is lesser than or equal to zero or is greater than the number of connectors that the chargebox has.
400AlreadyInTransactionThe given connector of the given chargebox is already involved in a transaction.
402ChargeboxNotFreeChargebox has a custom payment type that is not Free or you have set a global non Free payment type for the car/bicycle chargeboxes.
403APIKeyNotFoundAn invalid API key was given in the header of the request.
403RestAPINotEnabledREST API integration is set as disabled in the administration dashboard.
403InvalidSourceIPAddrThe request comes from an IP address that is different from the one given in the REST API integration configuration.
403ChargeboxNotActiveChargebox is not set as active in the administration dashboard.
404ChargeboxNotFoundNo chargebox with the give identifier was found.
429TooManyRequestsToo many start charge requests on the given chargebox and connector.
500InternalServerErrorSomething unexpected went wrong while executing the request.