Loading...

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 Plaspy REST API provides a robust and secure way to integrate Plaspy'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 Plaspy 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 Plaspy REST API is:

https://api.plaspy.com

Authentication Method

To communicate with the Plaspy 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 in Plaspy

  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 Plaspy REST API:

Operation Method Endpoint Description
Get Authentication Token POST /api/Auth/Token Obtain the Auth token to make requests to other endpoints.
List Devices GET /api/devices List active devices in the account.
Device Information GET /api/devices/{deviceId} Get information about a specific device.
Last Location GET /api/devices/{deviceId}/lastLocation Get the last recorded location of a device.
Get Locations POST /api/devices/{deviceId}/locations Get locations of a device within a date range.
Get Alerts POST /api/devices/{deviceId}/alerts Get alerts generated by a device within a date range.
List Groups GET /api/groups List all groups created in the account.
Create Group POST /api/groups Create a new group.
Group Information GET /api/groups/{groupId} Get information about a specific group.
Update Group PUT /api/groups/{groupId} Update information about a specific group.
Delete Group DELETE /api/groups/{groupId} Delete a specific group.
List Users GET /api/users List users registered in the account.
Create User POST /api/users Create a new user.
User Information GET /api/users/{userId} Get information about a specific user.
Update User PUT /api/users/{userId} Update information about a specific user.
Delete User DELETE /api/users/{userId} Delete a specific user.
Get Countries GET /api/users/countries Get the list of available countries.
Get Time Zones GET /api/users/timeZones Get the list of available time zones.

HTTP Status Codes

Status Code Description
200 OK The request was successful.
201 Created The request was successful and a new resource was created.
400 Bad Request There is an issue on the client side, parameters need to be validated.
401 Unauthorized A valid token was not provided.
403 Forbidden The user associated with the token does not have permission to make the request.
404 Not Found The requested resource does not exist.
408 Request Timeout The request did not complete within the allowed time.
409 Conflict A valid HTTP request, but the server attempts to place the resources in an impossible or inconsistent state.
415 Unsupported Media Type An unsupported media type was sent. The server expected JSON.
429 Too Many Requests Too many requests have been sent in a short period of time.
500 Internal Server Error Uncontrolled error during the request process.
503 Service Unavailable The API is unavailable due to temporary overload or maintenance.

Error Handling

Errors in the Plaspy 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 Plaspy API:

  • Requests per minute: Maximum of 60 requests.
  • Daily results per device: Limit of 25,000 results.

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

Index
Questions

We answer all support request within 24 business hours approximately, If you have a question that needs an immediate resolution, please contact us by other way.

We answer you in business hours, as soon as possible. We are located in Bogotá, Colombia, time zone (GMT-5).

Last modification: 2024-06-03 16:38:05