Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
  1. Make sure to first contact PowUnity in order to grant your account “Manager” rights.

  2. Note that new accounts created with this approach can not be used to login via the app. They are limited to be used for traccar iot.powunity.com and the API.

Manual Instructions

The following steps describe how to create a new user (steps 1-3) and assign / un-assign devices to a user (step 4)

  1. Open “User Management”

2. Open user creation dialog

3. Set name, email and password and confirm with checkmark

If you want to limit the permissions for this user, open the “Permissions” field and:

  • select device read only if the user should not be able to delete or change anything on this BikeTrax

  • set device limit to 0 to not allow this user to create new BikeTrax’s

4. To assign / un-assign devices to users, select the user, open device dialog, check / uncheck desired devices

Info

For fleets make sure that new BikeTrax’s are always created via your main fleet account (the billing account) and stay assigned to this account!
BikeTrax will stop sending if not assigned to a B2B account and there is no active trial or subscription related to it.

Image Modified

Image Modified

Image Modified

Image Modified

Implementation Instructions

...

Code Block
languagejs
  const TRACCAR_AUTH_TOKEN = 'AUTH_TOKEN_GIVEN_FROM_POWUNITY';
  const TRACCAR_API_URL = 'https://traccariot.powunity-staging.com/api';

  var name = 'Max Mustermann';
  var email = 'max@mustermann.at';
  var password = require('crypto').randomBytes(16).toString('hex');

  // Authorization token for your management Traccar user 
  var headers = { 
    'Content-Type': 'application/json',
    'authorization': 'Basic ' + TRACCAR_AUTH_TOKEN
  };

  var json = {
    name,
    email,
    password,
    deviceLimit: -1
  };
  
  console.log('Calling traccar API at', TRACCAR_API_URL);
  request.post({
    url: TRACCAR_API_URL + '/users',
    headers: headers,
    json: json
  }, function (err, response, body) {
    if (err) {
      console.log('Traccar create user API call returned an error,', err);
      throw new Error("Error provisioning server resource, please contact support");
    }
    // user created, add sessionToken to user profile
    if (response.statusCode === 200) {
      console.log('New traccar password has been set');
      return;
    }
    console.log('Traccar returned an unknown error. Body: ' + body);
    throw new Error("Internal error provisioning your account, please contact support");
  });

...