User

The User object represents the user who is being tracked. User objects can belong to a Group object. The identifier of the user is used in the SDK to identify the tracking device.

The User object

Property Type Description
id uuid string Unique identifier for the object
name string Name of the user
phone string E164 formatted phone number of user
group_id string The id of the fleet to which this user belongs
lookup_id string A unique id that you can add to the user to identify
availability_status string The availability status of the user, possible values are online, offline and active.
pending_actions JSON array List of action ids that have been assigned to the user and are not complete
last_location JSON The last known location of the user with the speed, bearing, location accuracy and recorded time fields
last_heartbeat_at ISO datetime string Date time for last communication with the user's device
last_online_at ISO datetime string Date time when the last tracking session was started for the user
created_at ISO datetime string Timestamp of when user was created
modified_at ISO datetime string Timestamp of when user was last modified

Availability statuses

Availability status Description
online When the user's session has been started with startTracking on the SDK
offline When the user's session has been ended by stopTracking on the SDK
active When the user has been assigned one or more Action - once the actions are completed, the user goes back to online

Create a User

This API will create and return a User object.

HTTP Request

POST https://api.hypertrack.com/api/v1/users/

Returns

Returns a user object if the call succeeded.

Parameters

Parameter Required Description
name No Name of the user
phone No E164 formatted phone number of the user
photo No A photo file of the user
lookup_id No A unique id that you can add to the user to search
group_id No The identifier of the group to which the user belongs
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"name\": \"User name\", \"phone\": \"+16502469293\"}" \
     https://api.hypertrack.com/api/v1/users/
hypertrack.User.create(
    name='User name',
    phone='+16502469293'
)
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
Map<String, Object> params = new HashMap<>();
params.put("name", "User name");
params.put("phone", "+16502469293");
User user = userFactory.create(params);

Retrieve a User

Retrieves a user object with the id.

HTTP Request

GET https://api.hypertrack.com/api/v1/users/<id>/

Returns

Returns a user object if a valid identifier was provided.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X GET \
     https://api.hypertrack.com/api/v1/users/d0ae4912-2074-45ef-a7c0-76be58639ea9/
user = hypertrack.User.retrieve('d0ae4912-2074-45ef-a7c0-76be58639ea9')
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
User user = userFactory.retrieve("d0ae4912-2074-45ef-a7c0-76be58639ea9");

Update a User

Edit an existing user object.

HTTP Request

PATCH https://api.hypertrack.com/api/v1/users/<id>/

Returns

Returns the updated user object.

Parameters

Parameter Required Description
name No Name of the user
phone No E164 formatted phone number of the user
photo No URL of the photo to be assigned to the user
lookup_id No A unique id that you can add to the user to search
group_id No The identifier of the group to which the user belongs
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"name\": \"User name\", \"phone\": \"+16502469293\"}" \
     https://api.hypertrack.com/api/v1/users/d0ae4912-2074-45ef-a7c0-76be58639ea9/
user = hypertrack.User.retrieve('d0ae4912-2074-45ef-a7c0-76be58639ea9')
user.name = 'New name'
user.photo = 'https://photo-url.com/photo.png'
user.save()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
User user = userFactory.retrieve("d0ae4912-2074-45ef-a7c0-76be58639ea9");

Map<String, Object> newParams = new HashMap<>();
newParams.put("name", "New name");
newParams.put("photo", "https://photo-url.com/photo.png");

userFactory.patch(user, newParams);

Delete a User

Delete an existing user object.

HTTP Request

DELETE https://api.hypertrack.com/api/v1/users/<id>/

Returns

Empty response if the object is deleted.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X DELETE \
     https://api.hypertrack.com/api/v1/users/d0ae4912-2074-45ef-a7c0-76be58639ea9/
user = hypertrack.User.retrieve('d0ae4912-2074-45ef-a7c0-76be58639ea9')
user.delete()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
User user = userFactory.retrieve("d0ae4912-2074-45ef-a7c0-76be58639ea9");
userFactory.delete(user);

List all Users

List all user objects. The list can be filtered using the following parameters.

HTTP Request

GET https://api.hypertrack.com/api/v1/users/

Returns

Returns a list of users.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
name No Filter users with names that contain this string
id No Filter users with a comma separated list of ids
group_id No Filter user objects by group
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X GET \
     https://api.hypertrack.com/api/v1/users/
users = hypertrack.User.list()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
HyperTrackArrayList<User> users = userFactory.list();

Assign Actions to a User

This API will assign a list of Action objects to a User.

HTTP Request

POST https://api.hypertrack.com/api/v1/users/<id>/assign_actions/

Returns

Returns a User object to which the actions are added.

Parameters

Parameter Required Description
action_ids Yes List of action ids to be assigned to the user
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"action_ids\": [\"6daacb03-6f02-4c60-b084-e9ffcd9eaf56\", \"37ae09b4-4801-48cb-bc50-99a7ee53f257\"]}" \
     https://api.hypertrack.com/api/v1/users/d0ae4912-2074-45ef-a7c0-76be58639ea9/assign_actions/
user = hypertrack.User.retrieve('d0ae4912-2074-45ef-a7c0-76be58639ea9')
user.assign_actions(action_ids=['6daacb03-6f02-4c60-b084-e9ffcd9eaf56', '37ae09b4-4801-48cb-bc50-99a7ee53f257'])
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
UserFactory userFactory = new UserFactory(client);
User user = userFactory.retrieve("d0ae4912-2074-45ef-a7c0-76be58639ea9");

List<String> actionIds = Arrays.asList("6daacb03-6f02-4c60-b084-e9ffcd9eaf56", "37ae09b4-4801-48cb-bc50-99a7ee53f257");
userFactory.assignActions(user, actionIds);

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""