User management | GPS-Trace

User management

User entities are created simultaneously with the client's account. When the partner creates accounts, they are initially created as inactive.

To activate the account, partner sends a special activation link to their client. The link format is as follows:

https://login.gurtam.space/registration/acknowledgment?client_id=00010000000000000500&login=test_user_name&login_key=1123456

Where:

  • client_id indicates the application affiliation:
    1. 00010000000000000500: Forguard
    2. 00010000000000000300: Ruhavik
    3. 00010000000000000400: Petovik
  • test_user_name is replaced with the name of the user of this account
  • login_key is the assigned login key during account creation.

Upon clicking the activation link, the client enters their unique email address (to be associated with the account) and a password.
Then client will receive a registration confirmation email at the provided address. By following the link in the email, client completes the registration process by entering the requested information in the form (which could include password, login key, etc.).
Once the client confirms registration, their account is activated, and the activation date and time are recorded in the ack field. After that, they will be able to log into the application using the email and password that they entered during registration.

Get list of users

Retrieves a list of all or filtered users associated with the partner's account. 

GET /partner/users

Example of success response:

{
  "data": [
    {
      "id": "string",
      "account_id": number,
      "name": "string",
      "email": "string",
      "description": "string",
      "login_key": "string",
      "lang": "string"
    },
     ...
   ]
}

  • id: - user ID.
  • account_id: - ID of the associated account.
  • name: - name of the user.
  • email: - email address of the user.
  • description: - description or additional information about the user.
  • login_key: - login key for account activation.
  • lang: - language preference of the user.

Update user

This method allows you to update the following user details:

  • name: name of the user.
  • description: additional information or description about the user.
  • login_key: login key for activation.
  • lang: language preference of the user.

Also it is important to notice that changes to user data are not available for activated Ruhavik/Petovik accounts.

PATCH /partner/users/{id}

Request example:

curl -X 'PATCH' \  'https://api.gps-trace.com/partner/users/1a2b3c4d567890' \
  -H 'accept: application/json' \
  -H 'X-AccessToken: <your token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Test_user",
  "description": "test description",
  "login_key": "123456",
  "lang": "es"
}'

Example of success response:

{
  "data": {
    "id": "1a2b3c4d567890",
    "account_id":111111,
    "name": "Test_user",
    "description": "test description",
    "login_key": null,
    "lang": "es"
  }
}

Change user password

This endpoint enables a partner to change the password of a client's Forguard account to a new one.

PUT /partner/users/{id}/password

Where

  • id: string - ID of user.

The mandatory fields for this request are the following:

  • new_password: string - new password 
  • repeat_password: string - this field requires re-entering the new password to ensure it was entered correctly. It should match the value provided in the "new_password" field to confirm the password change.

Request example:

curl -X 'PUT' \
  'https://api.gps-trace.com/partner/users/136e9ХХХХХХa4342a/password' \
  -H 'accept: application/json' \
  -H 'X-AccessToken: <your token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "new_password": "12345678",
  "repeat_password": "12345678"
}'

200 Response example:

{
  "data": {
    "id": "136e9ХХХХХХa4342a",
    "account_id": number,
    "enabled": true,
    "name": "string ",
    "email": "string",
    "description": "test description",
    "login_key": null,
    "lang": "es",
  }
}

Client Account Token

This endpoint is utilized for token generation and facilitates access to client's accounts in case of any issues. 

For Forguard accounts, two types of tokens can be used for entering a client's account for maintenance work: service and service_as_user.
When using the service token, all hidden elements or features from the client are visible to the partner for comprehensive account configuration and technical work.
The service_as_user token allows the partner to see all application features just as the client does.

On the other hand, Ruhavik and Petovik accounts have specific rules and limitations for partner access.
For activated Ruhavik/Petovik accounts, obtaining the service token (by default) is only possible when the service mode is enabled by the client. If the service mode is disabled by the client, the session will be terminated. The service_as_user token is not relevant for Ruhavik/Petovik accounts.

Currently, obtaining a token for an inactive Ruhavik/Petovik account is not possible.

PUT /partner/users/{id}/appToken/{app_id}

Where:

  • id: string - user ID
  • app_id: string - ID of the application:
    • Forguard - b901da51-ce00-4af2-b978-8d0fca8ae1ea
    • Ruhavik - 5a5ca87f-7cbe-4540-ab5d-77bf4bf69884
    • Petovik - 962e19f0-6b4a-4f81-a3fe-4b657689b6f9

Request example:

curl -X 'GET' \  'https://api.gps-trace.com/partner/users/13XXXXXXX4342a/appToken/b901da51-ce00-4af2-b978-8d0fca8ae1ea?token_type=service' \
  -H 'accept: application/json' \
  -H 'X-AccessToken: <your token>'

200 Response example:

{
  "data": {
    "id": number,
    "account_id": number,
    "expire": 0,
    "info": {
      "prefix": "service",
      "type": "fleet",
      "user_id": "13XXXXXXX4342a",
      "app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea"
    },
    "key": "<generated token>",
    "ttl": 3600,
    "url": "https://forguard.gurtam.space/auth/login/token/<generated token>"
  }
}

  • id: token ID
  • account_id: identifier of the account 
  • expire: token expiration date (milliseconds)
  • info: token metadata 
    • type: token type.
    • prefix: prefix indicating the type of token ("service", ”service_as_user”).
    • user_id: user identifier associated with this key.
    • app_id: application ID.
  • key: token value.
  • ttl: time-to-live of the token in seconds. In this case, the value is 3600 seconds, which corresponds to one hour.
  • url: link to a user account with an embedded token.