Skip to main content

Rest API

A REST API (Representational State Transfer) is a set of functions that allows communication and data exchange between different systems over the web. It uses standard HTTP methods such as GET, POST, PUT, DELETE to perform operations on resources, represented in JSON format. REST APIs are widely used for their simplicity, flexibility, and scalability.

the REST API provides a robust and secure way to integrate 's functionalities into your own applications. By following the guidelines above, you can make efficient requests and correctly manage errors and API limits. For more details, refer to the full REST API documentation.

Uses of a REST API

  • System Integration: Allows different systems and applications to communicate and share data efficiently.
  • Process Automation: Facilitates the automation of tasks and workflows.
  • Functionality Extension: Enables developers to add new functionalities to existing applications without modifying the base code.
  • Mobile Application Development: Provides an easy way to connect mobile applications to backend services.
  • Remote Access to Services: Allows access to services and data from anywhere with an internet connection.

Base URL for Requests

The base URL for all requests to the REST API is:

https://api.plaspy.com

Authentication Method

To communicate with the service, you must authenticate using an OAuth scheme. The first step is to generate a JWT (JSON Web Token) access token. This token is obtained through the following operation:

  • Endpoint: /api/Auth/Token
  • Method: POST
  • Description: Obtain the Auth token required to make requests to other API endpoints.

How to Use OAuth

  1. Generate an Authentication Token:
    • Endpoint: /api/Auth/Token
    • Method: POST
    • Description: Obtain the Auth token required to make requests to other API endpoints.
    • Request Example:

{ "userName": "your_username", "apiKey": "your_api_key" } 2. Include the Token in Requests:

  • Once the token is obtained, you must include it in the header of each API request.
  • Header: Authorization: Bearer your_token
  • Example of a GET request:
GET /api/devices HTTP/1.1 
Host: api.plaspy.com
Authorization: Bearer your\_token

Operations

Below is a table of available operations in the REST API:

OperationMethodEndpointDescription
Get Authentication TokenPOST/api/Auth/TokenObtain the Auth token to make requests to other endpoints.
List DevicesGET/api/devicesList active devices in the account.
Device InformationGET/api/devices/{deviceId}Get information about a specific device.
Last LocationGET/api/devices/{deviceId}/lastLocationGet the last recorded location of a device.
Get LocationsPOST/api/devices/{deviceId}/locationsGet locations of a device within a date range.
Get AlertsPOST/api/devices/{deviceId}/alertsGet alerts generated by a device within a date range.
List GroupsGET/api/groupsList all groups created in the account.
Create GroupPOST/api/groupsCreate a new group.
Group InformationGET/api/groups/{groupId}Get information about a specific group.
Update GroupPUT/api/groups/{groupId}Update information about a specific group.
Delete GroupDELETE/api/groups/{groupId}Delete a specific group.
List UsersGET/api/usersList users registered in the account.
Create UserPOST/api/usersCreate a new user.
User InformationGET/api/users/{userId}Get information about a specific user.
Update UserPUT/api/users/{userId}Update information about a specific user.
Delete UserDELETE/api/users/{userId}Delete a specific user.
Get CountriesGET/api/users/countriesGet the list of available countries.
Get Time ZonesGET/api/users/timeZonesGet the list of available time zones.

HTTP Status Codes

Status CodeDescription
200 OKThe request was successful.
201 CreatedThe request was successful and a new resource was created.
400 Bad RequestThere is an issue on the client side, parameters need to be validated.
401 UnauthorizedA valid token was not provided.
403 ForbiddenThe user associated with the token does not have permission to make the request.
404 Not FoundThe requested resource does not exist.
408 Request TimeoutThe request did not complete within the allowed time.
409 ConflictA valid HTTP request, but the server attempts to place the resources in an impossible or inconsistent state.
415 Unsupported Media TypeAn unsupported media type was sent. The server expected JSON.
429 Too Many RequestsToo many requests have been sent in a short period of time.
500 Internal Server ErrorUncontrolled error during the request process.
503 Service UnavailableThe API is unavailable due to temporary overload or maintenance.

Error Handling

Errors in the REST API have the following JSON structure:

{ "success": false, "error": "Message explaining the error." }

  • success: false when an error occurs in the request.
  • error: Message explaining the cause of the error.

Request Limits

It is important to consider the following limits when integrating the API:

  • Requests per minute: There is a limit on how many requests can be made to protect the system's performance.
  • Daily results per device: Each device has a daily limit on the number of results that can be consulted.

These limits are designed to ensure the performance and stability of the system.

Plaspy GPS Tracking Platform

Explore the Plaspy platform and compatible GPS devices

Browse technical guides, application documentation, compatible trackers, and setup resources to get more value from Plaspy.