Internal Auth API
Use the Auth API to:
- Get access company.
- Get ws host.
- Get version.
- Get beta version.
HTTP Headers
The HTTP headers are used to access all RTLS APIs are listed below. Before submitting requests to the company API, set the following headers.
| Header Name | Example Value | Description |
|---|---|---|
| X-User-Email | admin@example.com | Email of the user performing HTTP requests to the API. |
| X-User-Token | Drv3yU7PdyqUMtr89erZ | Token allowing user access to the API. |
NOTE: Headers are applying to public routes, routes starts with /api/private/... access from localhost and do not
require headers
Set header X-USER-EMAIL
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the email
address returned in the response, set: X-USER-EMAIL = data.email
Set header X-USER-TOKEN
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the
authentication token returned in the response, set: X-USER-TOKEN = data.token
Set header X-USER-PROJECT
Send a request to get projects using GET api/projects/ described in the Projects API.
You must send this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in
the response, set:
X-USER-PROJECT = projects[i].uid
Auth Endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| get access company | GET | /api/v2/auth/access_company/${company_uid}/ |
| get ws host | GET | /api/v2/wshost/ |
| get version | GET | /version |
| get beta version | GET | /api/v2/beta/version |
Endpoints
Get access company
GET /api/v2/auth/access_company/${company_uid}/
- Headers:
- X-User-Email
- X-User-Token
Login system_admin as company admin.
Response fields
| Field | Description |
|---|---|
| success | Request status true/false |
| data | Response body on success true |
| data.email | Impersonate company email for company actions |
| data.token | Impersonate company token for company actions |
| data.role | New system user role "company_admin" |
| data.company | |
| data.company.id | |
| data.company.name | |
| data.company.taggings_count | |
| data.company.user_params | |
| data.company.user_params.tag_allocation | |
| data.company.user_params.color | |
| data.company.user_params.phone | |
| data.company.user_params.address | |
| data.company.uid | |
| data.company.scope | |
| data.company.role_uid | |
| data.isSuperAdmin | |
| data.isSystemUser | |
| data.isCompanyAdmin | |
| data.sign_in_count | |
| data.isHighChartsLicensed | |
| data.needUpdatePassword | |
| error | Response body on success false |
Example Response
{
"success": true,
"data": {
"email": "redpoint_positioning_impersonate@ICI1r2srSjOeqMV0vZQqDA",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVzSW4iOjE4MDAsInVzZXIiOnsidWlkIjoiUEloUWkzc05SbXVycHRWRDdGUWlMQSIsInJvbGUiOiJjb21wYW55X2FkbWluIiwiZW1haWwiOiJyZWRwb2ludF9wb3NpdGlvbmluZ19pbXBlcnNvbmF0ZUBJQ0kxcjJzclNqT2VxTVYwdlpRcURBIiwicmVmcmVzaF90b2tlbiI6ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpsZUhCcGNtVnpTVzRpT2pFd016WTRNREF3TENKcFpDSTZJakJ2Y0RaaWMyNTZVMVpoWldsR1IxTTJObDgxV2tFaUxDSnBZWFFpT2pFM01EUTBPREk1TURWOS50R2FuZk52MlMyQUoyY3VQSmJkckRtSjJ1cG9ZTXAxcWxEaFJQNU9aUjJRIiwiY29tcGFueV91aWQiOiJJQ0kxcjJzclNqT2VxTVYwdlpRcURBIiwic3RhdHVzIjoiQUNUSVZFIn0sImlhdCI6MTcwNzIxMzMwOX0.4WOkygDUue_eXc2qOCVt_dRo6E9g7E5F9xqrREW0hwo",
"role": "company_admin",
"company": {
"id": 20362,
"name": "Company Two",
"taggings_count": 0,
"user_params": {
"tag_allocation": true,
"color": "#0094f0",
"phone": "2898872619",
"address": "214-26 Gibbs Rd"
},
"uid": "ICI1r2srSjOeqMV0vZQqDA",
"scope": "Y",
"role_uid": "Hyf5F8KqEeagPwhgboMCKw"
},
"isSuperAdmin": false,
"isSystemUser": false,
"isCompanyAdmin": true,
"sign_in_count": 6,
"isHighChartsLicensed": true,
"needUpdatePassword": true
}
}
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 422 | Validation Error | Credentials are invalid | Param "email" or "password" is required |
Get ws host
GET /api/v2/wshost/
- Headers:
- No
Get URI to connect to websocket when connect to https:// server use protocol wss://<wsHost>
Response fields
| Field | Description |
|---|---|
| wsHost | websocket URI |
Example Request
{
"wsHost": "dev7-ubuntu.rpplabs.com/api/ws/"
}
Get version
GET /version
- Headers:
- X-User-Email
- X-User-Token
Response fields
| Field | Description |
|---|---|
| api_version | Basic API version: constant value 2.0 |
| mysql_version | Version of mysql on server-machine |
| node_version | Value of process.version |
| modules | Loaded modules, value of process.moduleLoadList |
| user_modules | rtls-serer package dependency modules |
Example Request
{
"api_version": "2.0",
"mysql_version": "10.6.16-MariaDB",
"node_version": "20.5.1",
"modules": [
...
"Internal Binding v8",
"NativeModule v8",
"NativeModule internal/child_process/serialization"
],
"user_modules": [
"@hapi/joi",
"api-error-handler",
"archiver",
...
]
}
Get beta version
GET /api/v2/beta/version
TODO: require to find what it is