Create a new connected vehicle

To connect to a vehicle, a new connected vehicle needs to be created. A connected vehicle is tied to a Chargetrip vehicle profile by id. Each vehicle exposes the connect providers available for that particular vehicle. The carList filter capabilities can be used to find all vehicles that can be connected through a specific provider.

If you are looking for other providers or missing features, please contact sales@chargetrip.com.

Note

Connected vehicles are tied to an authenticated user. In order to use the vehicle connectivity operations provide a valid Authorization header. Your customer support manager can provide more information on how to integrate user authentication.

Mutation

To create a new connected vehicle provide the vehicle_id, provider and options input arguments. Optionally a label argument can be provided to give the connected vehicle a unique name.

To find out which vehicles are supported by the provider configured on your project query the vehicle list with the connect.provider field or use the filter argument.

Based upon the provider specific steps are required which are described below.

Enode

After executing the mutation a new connected vehicle with a status pending will be returned. The authorization_url field provides you with a custom link to set up the connection with the vehicle. Open the url in a web browser and go through the Enode flow before continuing with the authorizeConnectedVehicle mutation.

After finishing the flow a redirect will be triggered towards the options.redirect_uri.

Arguments

input input_object CreateConnectedVehicleInput

Frequently used fields

id non_null ID

Unique ID of the connected vehicle

status non_null ConnectedVehicleStatus

Status of the connected vehicle

authorization_url scalar String

URL to connect the vehicle to the connectivity provider

Other fields

vehicle_id non_null ID

Unique ID of the vehicle

provider non_null CarConnectivityProvider

Connectivity provider

scope list ConnectScope

Scope for accessing the vehicle

label scalar String

Custom label for a connected vehicle that can be assigned by a user

vin scalar String

Vehicle identification number, unique identifier for a vehicle

Response

A response can either contain a data or an errors object. The response header will always return 200 as a status code.

Data object

When successful, a data object will be returned with the requested fields. If there are no fields present the data object will return the operation name with the appropriate return type. If the operation was a query, this output will be an object of the schema’s query root type; if the operation was a mutation, this output will be an object of the schema’s mutation root type.

Error object

If unsuccessful, an errors object will be returned with more details in the extensions object. The error object can contain any of the following objects.

Error

AUTH_TOKEN_EXPIRED

The token you provided is expired

Error

AUTH_TOKEN_INVALID

The token you provided is invalid

Error

CONNECT_PROVIDER_NOT_ALLOWED

The Connect provider $PROVIDER is not configured for your client id. Please contact customer support to enable it!

Error

CONNECT_VEHICLE_NOT_SUPPORTED

The provider you tried to use ($PROVIDER) cannot be used for this vehicle

Error

CONNECTED_VEHICLE_PER_MAKE_LIMIT_REACHED

The maximum number of vehicles per make ($LIMIT) was reached

Error

NEW_CONNECTED_VEHICLE_INVALID_OPTIONS_ENODE

Provided options are invalid. Enode requires the following options: redirect_uri, scope

Error

VEHICLE_ALREADY_CONNECTED

This vehicle has already been connected to a provider for this user.