### Example API Request with Version Header Source: https://docs.co3.tech/docs/latest/api-design/versioning This is an example of an HTTP GET request to the /api/assets endpoint, specifying the API version via the 'Api-Version' header. ```http GET /api/assets HTTP/1.1 Host: openapi.co3.tech Api-Version: 2.0 Authorization: Bearer ``` -------------------------------- ### Fetch All Assets using GET Source: https://docs.co3.tech/docs/latest/api-design/api-overview Use this GET request to retrieve a list of all available assets. ```http GET https://openapi.co3.tech/api/assets ``` -------------------------------- ### Example curl Request Source: https://docs.co3.tech/docs/latest/api-design/api-overview This is an example of a basic curl request to the CO3 API base URL. ```bash $ curl -i https://openapi.co3.tech ``` -------------------------------- ### Fetch Asset by ID using GET Source: https://docs.co3.tech/docs/latest/api-design/api-overview Use this GET request to retrieve information about a specific asset using its ID. ```http GET https://openapi.co3.tech/api/assets/2 ``` -------------------------------- ### Sunset Header Example Source: https://docs.co3.tech/docs/latest/api-design/versioning This example demonstrates the 'Sunset' HTTP header, indicating the specific date after which an API will no longer be available. Clients should update integrations before this date. ```http Sunset: Wed, 01 Jul 2025 00:00:00 GMT ``` -------------------------------- ### Deprecation Header Example Source: https://docs.co3.tech/docs/latest/api-design/versioning This example shows the 'Deprecation' HTTP header, which signals that an endpoint is deprecated and will be removed in the future. It can be a boolean or a date. ```http Deprecation: true ``` ```http Deprecation: Wed, 01 Jan 2025 00:00:00 GMT ``` -------------------------------- ### Request Access Token with cURL Source: https://docs.co3.tech/docs/latest/api-design/api-access Example of how to request an access token using cURL. Ensure you replace placeholders with your actual client ID, client secret, and desired scopes. ```bash curl -X POST https://openapi.co3.tech/auth/token \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" \ -d "scope=YOUR_SCOPES" ``` -------------------------------- ### Example HTTP 404 Response Source: https://docs.co3.tech/docs/latest/api-design/api-overview This is an example of a 404 Not Found response from the CO3 API, including headers and a JSON error body. The Trace-Id header is crucial for issue reporting. ```http HTTP/1.1 404 Not Found Connection: keep-alive Trace-Id: 99436185-4d7c-483b-a594-e56cbfcec360 Content-Type: application/json; charset=utf-8 Content-Length: 165 Date: Tue, 08 Sep 2015 07:59:45 GMT X-Frame-Options: SAMEORIGIN ``` ```json { "errors": [ { "code": "NotFoundException", "message": "Not found", "details": null, "path": null, "userMessage": "Function unavailable. Contact the application author." } ] } ``` -------------------------------- ### GET /api/assets Source: https://docs.co3.tech/docs/latest/api-design/api-overview Retrieves a list of all available assets. ```APIDOC ## GET /api/assets ### Description Retrieves a list of all available assets within the system. ### Method GET ### Endpoint `https://openapi.co3.tech/api/assets` ``` -------------------------------- ### Example Resource Identifier (UUID) Source: https://docs.co3.tech/docs/latest/api-design/api-overview API requests return resource identifiers as strings, typically in UUID format. It is recommended to store these identifiers as strings. ```text bg645d84-75b4-431b-adb2-eb6b9e546059 ``` -------------------------------- ### HTTP Methods Overview Source: https://docs.co3.tech/docs/latest/api-design/api-overview The CO3 REST API supports standard HTTP methods for interacting with resources: GET, POST, PUT, and PATCH. ```APIDOC ## HTTP Methods Each API resource supports the following HTTP methods: ### GET - **Purpose**: Retrieves data from a resource. - **Idempotency**: Safe to call multiple times; does not modify resources. ### POST - **Purpose**: Creates a new resource. - **Example**: Creating a new monitoring order generates a `/api/monitoring-orders` resource. - **Idempotency**: Calling POST twice on the same endpoint will create two separate resources. ### PUT - **Purpose**: Updates and replaces an existing resource entirely. - **Example**: Modifying a whole monitoring order. - **Idempotency**: Calling PUT twice on the same resource is safe and results in the same state. ### PATCH - **Purpose**: Performs partial updates on a resource. - **Example**: Modifying only the `name` field of a monitoring order without resending the entire model. ``` -------------------------------- ### GET /api/assets/{id} Source: https://docs.co3.tech/docs/latest/api-design/api-overview Fetches detailed information about a specific asset using its ID. ```APIDOC ## GET /api/assets/{id} ### Description Fetches detailed information about a specific asset identified by its unique ID. ### Method GET ### Endpoint `https://openapi.co3.tech/api/assets/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the asset. ``` -------------------------------- ### Example Country Code (ISO 3166 alpha-2) Source: https://docs.co3.tech/docs/latest/api-design/api-overview Country codes are presented in the ISO 3166 alpha-2 standard. ```text PL ``` -------------------------------- ### Example JSON Response Structure Source: https://docs.co3.tech/docs/latest/api-design/api-overview This JSON structure demonstrates how asset identifiers are represented, including VIN and license plate details. Note that empty fields with null values are never omitted. ```json { "assetIdentifiers": [ { "type": "vin", "value": "1HGCM82633A123456" }, { "type": "license-plate", "value": "PLXYZ1234", "number": "XYZ1234", "countryCode": "PL" } ] } ``` -------------------------------- ### Get Access Token (OAuth2 Client Credentials) Source: https://docs.co3.tech/docs/latest/api-design/api-access Obtain an access token using the OAuth2 client credentials grant type. This token is required for authenticating subsequent API requests. ```APIDOC ## Get Access Token ### Description To authenticate with the API, you must first obtain an access token using the OAuth2 protocol. This endpoint supports the OAuth2 "client credentials" grant type, suitable for server-to-server integrations. You will need your client ID, client secret, and the token endpoint URL. ### Method POST ### Endpoint https://openapi.co3.tech/auth/token ### Parameters #### Request Body - **grant_type** (string) - Required - Must be set to "client_credentials". - **client_id** (string) - Required - Your client ID provided after approval. - **client_secret** (string) - Required - Your client secret provided after approval. - **scope** (string) - Optional - The scope of the access requested. ### Request Example ```bash curl -X POST https://openapi.co3.tech/auth/token \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" \ -d "scope=YOUR_SCOPES" ``` ### Response #### Success Response (200 OK) - **access_token** (string) - The obtained access token. - **token_type** (string) - The type of token, typically "Bearer". - **expires_in** (integer) - The time in seconds until the token expires. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsIn...", "token_type": "Bearer", "expires_in": 3600 } ``` ### Usage Use the obtained `access_token` in the `Authorization` header of your subsequent API requests as a Bearer token: `Authorization: Bearer YOUR_ACCESS_TOKEN`. ``` -------------------------------- ### API Resources Source: https://docs.co3.tech/docs/latest/api-design/api-overview The CO3 platform organizes its functionalities into resources. Access to these resources is achieved by appending their respective paths to the base URL. ```APIDOC ## API Resources The CO3 platform provides access to its functionalities through various resources. The base URL for the API is `https://openapi.co3.tech`. ### Available Resources: * `/api/assets` * `/api/inbound-telematic-connections` * `/api/outbound-telematic-connections` To interact with a resource, append its path to the base URL. For example, to access assets, use `https://openapi.co3.tech/api/assets`. ``` -------------------------------- ### API Response for Missing Version Header Source: https://docs.co3.tech/docs/latest/api-design/versioning This JSON response indicates a 400 Bad Request error due to a missing 'Api-Version' header. This is the default behavior when no version is specified. ```json { timestamp: 1749650167439, status: 400, error: 'Bad Request', errorCode: 'MISSING_API_VERSION_HEADER', path: '/api/inbound-telematic-connections' } ``` -------------------------------- ### API Credential Request Source: https://docs.co3.tech/docs/latest/api-design/api-access To gain access to the API, please email api@co3.io with your use case and contact details. Secure credentials will be provided after review. ```APIDOC ## API Credential Request ### Description To request access to the CO3 Tech API, please send an email to api@co3.io. Include a brief description of your intended use case and your relevant contact details. Our team will review your request and provide you with secure credentials through a secure communication channel. ### Contact Email api@co3.io ``` -------------------------------- ### Communication Protocol and Data Format Source: https://docs.co3.tech/docs/latest/api-design/api-overview The CO3 API uses HTTPS for secure communication and JSON for data exchange. ```APIDOC ## Communication Protocol and Data Format ### Protocol Access to the REST API is established via **HTTPS** connection to the server. ### Base URL `https://openapi.co3.tech` ### Data Format All data sent to and received from the server is in **JSON format**. ### JSON Structure - Fields consist of a **name** followed by a colon `:` and a **value**. - Fields are separated by **commas**. - JSON objects are enclosed in **curly braces `{}`**. - JSON arrays are enclosed in **square brackets `[]`**. - Empty fields with `null` values are **never omitted** in the response. ### Example JSON Response ```json { "assetIdentifiers": [ { "type": "vin", "value": "1HGCM82633A123456" }, { "type": "license-plate", "value": "PLXYZ1234", "number": "XYZ1234", "countryCode": "PL" } ] } ``` ### Trace-Id Header Each response includes a `Trace-Id` header, which uniquely identifies the client's HTTP request. This ID should be included when reporting issues. ``` -------------------------------- ### ISO 8601 Date and Time Format Source: https://docs.co3.tech/docs/latest/api-design/api-overview All date, time, and duration fields are presented in the ISO 8601 standard. The 'Z' suffix indicates Zulu Time, which is Coordinated Universal Time (UTC). ```text YYYY-MM-DDTHH:MM:SSZ ``` -------------------------------- ### Successful Token Response Source: https://docs.co3.tech/docs/latest/api-design/api-access A successful response from the token endpoint will contain the access token, its type, and expiration time. Use the 'access_token' in the 'Authorization' header for subsequent API calls. ```json { "access_token": "eyJhbGciOiJIUzI1NiIsIn...", "token_type": "Bearer", "expires_in": 3600 } ``` -------------------------------- ### API Token Endpoint Source: https://docs.co3.tech/docs/latest/api-design/api-access The URL for the OAuth2 token endpoint. Use this to request an access token. ```http POST https://openapi.co3.tech/auth/token ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.