# \*Vehicles

## Create Vehicle

<mark style="color:green;">`POST`</mark> `https://services.telematicssdk.com/api/carservice/v1/Vehicles`

**Authorization:** Allow Anonymous

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| deviceToken | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": "fafdebac-e7e7-4386-827e-8d16eabc8c41", // Vehicle token
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request Body" %}

```
{
  "plateNumber": "string",
  "vin": "string",
  "manufacturerId": 0, // make id from directories
  "modelId": 0, // model id from directories
  "carYear": 2010,
  "specialMarks": "string", 
  "nvic": "string", // https://www.mycarinfo.com.my/Home/FAQ#:~:text=NVIC,the%20vehicle%20throughout%20its%20lifespan.
  "initialMilage": 100,
  "vehicleId": "string", // vehicle identifier in your system (if have)
  "name": "string",
  "allowedDrivers": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ], // another drivers device tokens (except primary driver deviceToken in header)
  "entityStatus": "Active" //  { Active = 1, Deactivated = 2 } deactivated vehicles are not given for search queries 
  "colorType": "Pearl" // { Solid = 1, Metallic = 2, Pearl = 3,} 
}
```

{% endtab %}
{% endtabs %}

## Update Vehicle

<mark style="color:orange;">`PUT`</mark> `https://services.telematicssdk.com/api/carservice/v1/Vehicles/{VehicleToken}`

**Authorization:** Allow Anonymous

#### Path Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| vehicleToken | string |             |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| deviceToken | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": null,
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request Body" %}

```
  "modelId": 0, // model id from directories
  "carYear": 2010,
  "specialMarks": "string", 
  "nvic": "string", // https://www.mycarinfo.com.my/Home/FAQ#:~:text=NVIC,the%20vehicle%20throughout%20its%20lifespan.
  "initialMilage": 100,
  "vehicleId": "string", // vehicle identifier in your system (if have)
  "name": "string",
  "allowedDrivers": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ], // another drivers device tokens (except primary driver deviceToken in header)
  "entityStatus": "Active" //  { Active = 1, Deactivated = 2 } deactivated vehicles are not given for search queries 
  "colorType": "Pearl" // { Solid = 1, Metallic = 2, Pearl = 3,} 
}
```

{% endtab %}
{% endtabs %}

## Delete Vehicle

<mark style="color:red;">`DELETE`</mark> `https://services.telematicssdk.com/api/carservice/v1/Vehicles/{VehicleToken}`

**Authorization:** Allow Anonymous

#### Path Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| vehicleToken | string |             |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| deviceToken | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": null,
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Get a list of User's Vehicles

<mark style="color:blue;">`GET`</mark> `https://services.telematicssdk.com/api/carservice/v1/Vehicles`

**Authorization:** Allow Anonymous

#### Headers

| Name        | Type   | Description                |
| ----------- | ------ | -------------------------- |
| deviceToken | string | GUID \| User's deviceToken |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "Cars": [
      {
        "Token": "4cbe2ed5-d828-4ae8-8de3-5dc77bfce13a",
        "Name": "PORSCHE, 911 ",
        "PlateNumber": "string",
        "Vin": "string",
        "Manufacturer": "Honda",
        "Model": "Accord",        
        "CarYear": 2020,
        "SpecialMarks": "string",
        "Nvic": "string"
        "InitialMilage": 18.5,
        "InitialOdometerMileage": 65000,
        "VehicleId": "string",
        "LastKnownMileage": 1000,
        "LastKnownMileageDate": "2020-04-10T14:50:46.0048083"
      },
      {
        "Token": "7e40bb4d-8fdf-41de-8927-4090b6f32cc1",
        "Name": "PORSCHE, 911 ",
        "PlateNumber": "string",
        "Vin": "string",
        "Manufacturer": "Honda",
        "Model": "Accord",        
        "CarYear": 2020,
        "SpecialMarks": "string",
        "Nvic": "string"
        "InitialMilage": null,
        "InitialOdometerMileage": null,
        "VehicleId": "string",
        "LastKnownMileage": 1000,
        "LastKnownMileageDate": "2020-04-10T14:50:46.0048083"
      }
    ]
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Get Vehicle Info

<mark style="color:blue;">`GET`</mark> `https://services.telematicssdk.com/api/carservice/v1/Vehicles/{VehicleToken}`

**Authorization:** Allow Anonymous

#### Query Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| VehicleToken | string |             |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| deviceToken | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
        "Token": "4cbe2ed5-d828-4ae8-8de3-5dc77bfce13a",
        "Name": "PORSCHE, 911 ",
        "PlateNumber": "string",
        "Vin": "string",
        "Manufacturer": "Honda",
        "Model": "Accord",
        "BodyType": null,
        "CarYear": 2020,
        "SpecialMarks": "string",
        "Nvic": "string"
        "InitialMilage": 18.5,
        "InitialOdometerMileage": 65000,
        "VehicleId": "string",
        "LastKnownMileage": 1000,
        "LastKnownMileageDate": "2020-04-10T14:50:46.0048083"
  }
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Get vehicles by Company

<mark style="color:blue;">`GET`</mark> `https://services.telematicssdk.com/api/carservice/v1/companies/{CompanyId}/vehicles`

**Authorization:** Allow Anonymous

#### Path Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| companyID | string |             |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| deviceToken | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
        "Token": "4cbe2ed5-d828-4ae8-8de3-5dc77bfce13a",
        "Name": "PORSCHE, 911 ",
        "PlateNumber": "string",
        "Vin": "string",
        "Manufacturer": "Honda",
        "Model": "Accord",
        "BodyType": null,
        "CarYear": 2020,
        "SpecialMarks": "string",
        "Nvic": "string"
        "InitialMilage": 18.5,
        "InitialOdometerMileage": 65000,
        "VehicleId": "string",
        "LastKnownMileage": 1000,
        "LastKnownMileageDate": "2020-04-10T14:50:46.0048083"
  }
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}
