### Create a Vehicle using cURL Source: https://api.onswitchboard.com/index Illustrates how to create a new vehicle resource via the Switchboard API using a `POST` request. This example includes the `Content-Type` header and a JSON payload with vehicle details. ```shell curl -X POST https://api.onswitchboard.com/v1/vehicles \ -H "Content-Type: application/json" \ -H "x-api-id: $SWITCHBOARD_API_ID" \ -H "x-api-key: $SWITCHBOARD_API_KEY" \ -d '{ "unitId": "002", "licensePlate": { "value": "ABC123", "jurisdiction": "BC" } }' ``` -------------------------------- ### Fetch Vehicles using cURL Source: https://api.onswitchboard.com/index Shows how to retrieve a list of vehicles from the Switchboard API using a `GET` request. It includes query parameters for pagination and limiting results, along with the necessary authentication headers. ```shell curl -X GET https://api.onswitchboard.com/v1/vehicles?limit=20&page=0 \ -H "x-api-id: $SWITCHBOARD_API_ID" \ -H "x-api-key: $SWITCHBOARD_API_KEY" ``` -------------------------------- ### Authenticate API Requests with cURL Source: https://api.onswitchboard.com/index Demonstrates how to authenticate API requests using `curl` by including the `x-api-id` and `x-api-key` headers. This is crucial for all interactions with the Switchboard API. ```shell curl https://api.onswitchboard.com/v1/vehicles \ -H "x-api-id: $SWITCHBOARD_API_ID" \ -H "x-api-key: $SWITCHBOARD_API_KEY" ``` -------------------------------- ### Creating a Vehicle Source: https://api.onswitchboard.com/index Creates a new vehicle. If successful, the corresponding response will return the newly created vehicle and its id. ```APIDOC ## POST /v1/vehicles ### Description Creates a new vehicle in the system. ### Method POST ### Endpoint /v1/vehicles ### Parameters #### Request Body - **unitId** (string) - Required - The unit identifier for the new vehicle. - **licensePlate** (object) - Optional - Information about the vehicle's license plate. - **value** (string) - Required - The license plate number. - **jurisdiction** (string) - Required - The jurisdiction of the license plate. ### Request Example ```bash curl -X POST https://api.onswitchboard.com/v1/vehicles \ -H "Content-Type: application/json" \ -H "x-api-id: $SWITCHBOARD_API_ID" \ -H "x-api-key: $SWITCHBOARD_API_KEY" \ -d '{ "unitId": "002", "licensePlate": { "value": "ABC123", "jurisdiction": "BC" } }' ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created vehicle. - **unitId** (string) - The unit identifier for the vehicle. - **licensePlate** (object) - Information about the vehicle's license plate. - **value** (string) - The license plate number. - **jurisdiction** (string) - The jurisdiction of the license plate. - **vinNumber** (string) - The Vehicle Identification Number. - **vehicleType** (string) - The type of the vehicle. - **nextInspectionDate** (string) - The date of the next inspection. - **inspectionFrequencyMonths** (integer) - The frequency of inspections in months. - **dashcamHardwareId** (string) - The hardware ID of the dashcam. - **mviDecalNumber** (string) - The MVI decal number. - **engineModuleId** (string) - The ID of the engine module. - **notes** (string) - Any additional notes about the vehicle. #### Response Example ```json { "id": "u34d4Ebl18", "unitId": "002", "licensePlate": { "value": "ABC123", "jurisdiction": "BC" }, "vinNumber": null, "vehicleType": null, "nextInspectionDate": null, "inspectionFrequencyMonths": null, "dashcamHardwareId": null, "mviDecalNumber": null, "engineModuleId": null, "notes": null } ``` ``` -------------------------------- ### Fetching Vehicles Source: https://api.onswitchboard.com/index Queries for a list of vehicles. The corresponding response contains the list of vehicles and their attributes. ```APIDOC ## GET /v1/vehicles ### Description Fetches a list of vehicles with optional pagination and filtering. ### Method GET ### Endpoint /v1/vehicles ### Query Parameters - **limit** (integer) - Optional - The maximum number of vehicles to return per page. - **page** (integer) - Optional - The page number to retrieve. ### Request Example ```bash curl -X GET https://api.onswitchboard.com/v1/vehicles?limit=20&page=0 \ -H "x-api-id: $SWITCHBOARD_API_ID" \ -H "x-api-key: $SWITCHBOARD_API_KEY" ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the vehicle. - **unitId** (string) - The unit identifier for the vehicle. - **licensePlate** (object) - Information about the vehicle's license plate. - **value** (string) - The license plate number. - **jurisdiction** (string) - The jurisdiction of the license plate. - **vinNumber** (string) - The Vehicle Identification Number. - **vehicleType** (string) - The type of the vehicle. - **nextInspectionDate** (string) - The date of the next inspection. - **inspectionFrequencyMonths** (integer) - The frequency of inspections in months. - **dashcamHardwareId** (string) - The hardware ID of the dashcam. - **mviDecalNumber** (string) - The MVI decal number. - **engineModuleId** (string) - The ID of the engine module. - **notes** (string) - Any additional notes about the vehicle. #### Response Example ```json [ { "id": "lnzTIBw9uT", "unitId": "001", "licensePlate": { "value": null, "jurisdiction": null }, "vinNumber": null, "vehicleType": null, "nextInspectionDate": null, "inspectionFrequencyMonths": null, "dashcamHardwareId": null, "mviDecalNumber": null, "engineModuleId": null, "notes": null } ] ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.