To interact with the Factory IL GPS REST API, you need to authenticate using an OAuth authentication scheme. The authentication process ensures that only authorized users can access the API resources. This document explains how to generate an authentication token (JWT) and how to use it to make requests to other API endpoints.
Authentication is a crucial step to ensure that only authorized users can access the Factory IL GPS REST API. By following the mentioned steps, you can generate an authentication token and use it to interact with the various API endpoints securely and efficiently. For more details on other operations, refer to the full Factory IL GPS REST API documentation .
Authentication Endpoint
Obtain the Authentication Token
The authentication token is obtained by making a POST request to the /api/Auth/Token
endpoint. Below are the steps to make this request.
Request Details
- Endpoint:
/api/Auth/Token
- Method:
POST
- Header:
Content-Type: application/json
- Base URL:
https://api.plaspy.com
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
userName | String | Yes | Your Factory IL GPS username. |
apiKey | String | Yes | Your API key provided by Factory IL GPS. |
Request Body
{
"userName": "your_username",
"apiKey": "your_api_key"
}
Request Example
POST /api/Auth/Token HTTP/1.1
Host: api.plaspy.com
Content-Type: application/json
{
"userName": "your_username",
"apiKey": "your_api_key"
}
Response Parameters
Parameter | Type | Description |
---|---|---|
success | Boolean | Indicates if the request was successful (true or false ). |
token | String | The JWT authentication token. |
expires | String | The token's expiration date and time. |
error | String | Message explaining the cause of the error (if applicable). |
Successful Response Example
{
"success": true,
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXV...",
"expires": "2023-12-31T23:59:59Z"
}
Error Response Example
{
"success": false,
"error": "Invalid API key or username."
}
Using the Authentication Token
Once the authentication token is obtained, it must be included in the Authorization
header of all API requests. The header format is Authorization: Bearer your_token
.
Request Example with Token
GET /api/devices
HTTP/1.1
Host: api.plaspy.com
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXV...
Error Handling
If the request to obtain the authentication token fails, the response will include an error message explaining the cause of the failure.
Error Response Example
{
"success": false,
"error": "Invalid API key or username."
}
- success: Indicates that the request failed (
false
). - error: Message explaining the cause of the error.
Security Considerations
- Token Protection: Keep your authentication token secure and do not share it with unauthorized third parties.
- Token Renewal: The token has an expiration date (
expires
). Ensure to renew it before it expires to maintain continuous access to the API.
- Welcome to Factory IL GPS help
- Map
- Viewing a Device's Route History
- Device Control Panel
- Detailed Device Information
- Buttons on the Map
- Details
- Trip Statistics
- Device Menu
- GeoFences
- Bulk Alert Editing
- Enable map notifications
- Mileage Calculation
- Atributes
- Devices
- Marker Icon
- Information
- Sensors
- Reassign Digital Sensors
- Commands
- Alerts
- Types
- Configuration
- Reminders
- Limits
- History
- Setting Up a New Tracker
- Solution for Identifier Already in Use by Another Account
- Device Issues
- Email alerts sending limits
- Reports
- New Report
- My Account
- Password Change
- Email Notifications
- Telegram Accounts
- Update Mobile Phone Number
- Primary Email
- Alternative Email
- Activate Two-Factor Authentication (2FA)
- Access Log
- Password Recovery
- Recover Username
- Delete Your Account
- Statistics
- Activity Summary
- Groups
- Users
- Share Access
- Developers
- Enable the API
- Rest API
- Authentication
- Devices API
- GET /api/devices
- GET /api/devices/{deviceId}
- GET /api/devices/{deviceId}/lastLocation
- POST /api/devices/{deviceId}/locations
- POST /api/devices/{deviceId}/alerts
- Groups API
- GET /api/groups
- POST /api/groups
- GET /api/groups/{groupId}
- PUT /api/groups/{groupId}
- PATCH /api/groups/{groupId}
- DELETE /api/groups/{groupId}
- Users API
- GET /api/users
- POST /api/users
- GET /api/users/countries
- GET /api/users/timeZones
- GET /api/users/{userId}
- PUT /api/users/{userId}
- PATCH /api/users/{userId}
- DELETE /api/users/{userId}