Skip to main content

Quick Start

tip

Get started immediately and perform your first API request to retrieve the vehicles list here.

Getting started with the Cartrack Fleet API is straightforward. This section provides a basic example of how to make your first API call. While this example uses curl, which is a versatile and widely supported tool for making HTTP requests from the command line, you can adapt the principles to other programming languages and tools such as Python, JavaScript, or any HTTP client libraries.

Prerequisites

Before you proceed, make sure you have:

  • cURL installed: Ensure cURL is installed on your system. cURL is typically available on Unix, Linux, and macOS operating systems and can be installed on Windows.
  • Base URL and Authentication Credentials: You will need the base URL for the Cartrack Fleet API and valid credentials. For detailed guidance on obtaining these, please refer to the Authentication and Base URLs sections of our documentation.

Making an API Call

Here is how you can make an API call to retrieve a list of vehicles using curl:

curl --location '{baseUrl}/rest/vehicles' \
--header 'Accept: application/json' \
--header 'Authorization: Basic your_encoded_credentials'

Replace {baseUrl} with the actual base URL provided for the Cartrack Fleet API, and replace your_encoded_credentials with your Base64-encoded authorization credentials.

Understanding the Command

  • --location: This option instructs curl to follow any redirects the server sends as part of the HTTP request.
  • --header: Used to specify extra headers in the request. In this example, we specify the acceptance of JSON-formatted responses and include the authorization credentials.
  • The endpoint URL ({baseUrl}/rest/vehicles) specifies the API endpoint for retrieving the vehicle list.

Response

The API will return a JSON response containing a list of vehicles, each with details like vehicle ID, model, and other relevant information.

This basic example provides an initial framework for making API calls to the Cartrack Fleet API. You can adapt this example to fit the programming language or tool of your choice based on similar principles. For more detailed information on the API functionalities and additional endpoints, continue exploring our comprehensive API documentation.

Import to Postman

You can import the Cartrack OpenAPI specification into Postman to generate a ready-to-use collection of requests.

  • Spec URL: https://developer.cartrack.com/openapi/openapi.yaml
  • In Postman: click Import → Link, paste the URL, then click Import. Or use Import → File and upload the downloaded openapi.yaml.
  • Postman will create a collection of requests based on the spec.
  • Configure environment values:
    • Set the base URL using the guidance on the Base URLs page.
    • Configure authentication: Cartrack APIs use Basic Authentication. In Postman, open any request, go to the Authorization tab, choose Basic Auth, and enter your username and password. Alternatively, add the Authorization header with the value Basic <base64-encoded-credentials>. See the Authentication page for details on generating credentials.
  • Run individual requests or use the Collection Runner to execute multiple calls.