API Docs for: v1.0.1
Show:

Users Class

Module: API

Methods

delete

(
  • [email]
  • [mobile]
  • [employeeId]
)
Object

REST DELETE endpoint that removes an existing user. Credentials must be passed in basic authentication format (Authorization header). https://en.wikipedia.org/wiki/Basic_access_authentication

Your API Key grants access to the same channels that your user account has access to. To obtain an API Key, please email support@share911.com.

Field names are not case sensitive. 'Email' is equivalent to 'email'.

Examples:

curl -X DELETE --user 'api:YOUR_API_KEY' \
    https://api.share911.com/v1/users \
    -H "Content-Type: application/json" \
    -d '{
         "employeeId": "123"
        }'

curl -X DELETE --user 'api:YOUR_API_KEY' \
    https://api.share911.com/v1/users \
    -H "Content-Type: application/json" \
    -d '{
         "email":"foo.bar@example.com"
        }'

curl -X DELETE --user 'api:YOUR_API_KEY' \
    https://api.share911.com/v1/users \
    -H "Content-Type: application/json" \
    -d '{
         "mobile":"555-555-5555"
        }'

Parameters:

  • [email] String optional

    Email address of user to delete. Alias: Email

  • [mobile] String optional

    Mobile phone number of user to delete. Alias: PhoneNumber, phone_number

  • [employeeId] String optional

    Unique employee identification number of user to delete. Alias: EmployeeNumber, employee_number, employee_id

Returns:

Object:

Responses follow the JSend format, as found here: http://labs.omniti.com/labs/jsend

Example Responses:

{
  status: "success",
  data: {
    id: "XuBhoX3rtS6ADmYyD"   // Share911-assigned id of deleted user
  }
}

{
  status: "error",
  message: "Access denied"
}

{
  status: "error",
  message: "User not found"
}

deleteUser

(
  • context
  • apiUser
  • rawBody
)
private

Fully remove a user from a channel or all channels.

Parameters:

  • context Object
    • db Object

      MongoDB db connection

    • transaction Object

      Transaction obj used for logging

  • apiUser Object
  • rawBody Object
    • [email] String optional

      Email address of user to delete. Alias: Email

    • [mobile] String optional

      Mobile phone number of user to delete. Alias: PhoneNumber, phone_number

    • [employeeId] String optional

      Unique employee identification number of user to delete. Alias: EmployeeNumber, employee_number, employee_id

identifyShareIdsToRemove

(
  • apiUser
  • targetUser
)
Array private

The target user may be in channels that the API user does not have access to. In that case, remove all the channels that API user sees but not the other channels.

Parameters:

  • apiUser Object
  • targetUser Object

Returns:

Array:

shareIds to remove

save

(
  • shareIds
  • emails
  • [optionalShareIds]
  • [parentShareId]
  • [password]
  • [firstname]
  • [lastname]
  • [title]
  • [shift]
  • [deleteMobileWhenEmpty]
  • [mobile]
  • [employeeId]
  • [managerIds]
  • [contactName]
  • [contactPhone]
  • [contactEmail]
)
Object

REST POST endpoint that creates a new user or updates an existing user. Credentials must be passed in basic authentication format (Authorization header). https://en.wikipedia.org/wiki/Basic_access_authentication

Your API Key grants access to the same channels that your user account has access to. To obtain an API Key, please email support@share911.com.

Field names are not case sensitive. FirstName, firstname, and firstName are all equivalent.

Here is an example API call, assuming your account has access to the channels with ShareIDs "acme" and "school":

Example:

curl -X POST --user 'api:YOUR_API_KEY' \
    https://api.share911.com/v1/users \
    -H "Content-Type: application/json" \
    -d '{
         "shareIds":["acme", "school"],
         "employeeId": "123",
         "managerIds": "120",
         "emails":"foo.bar@example.com",
         "firstname":"Foo",
         "lastname":"Bar",
         "title":"Accountant",
         "shift":"1st Shift",
         "mobile":"555-555-5555"
        }'

Parameters:

  • shareIds Array.string | String

    List of ShareIDs that target user should have access to. Target user will have default permissions for these channels (Liveview & Check-In). Alias: DepartmentCode, DepartmentID, DeptCode, DeptID, Location

  • emails Array.string | String

    List of emails associated with user. First email in list will be used when sending alerts. Alias: Email

  • [optionalShareIds] Array.string | String optional

    List of ShareIDs that should be left as-is on the target user's account, if they already have access. For example, if the api call has "shareIds": ["foo", "foo2" and the user already has access to "acme", then after the save, the user will only have access to "foo" and "foo2", loosing access to "acme". Usually, this is what you want but sometimes the user should keep specific other access if they already have it. For example, if "optionalShareIds": "acme" is set then the user will keep the "acme" access, and gain access to "foo" and "foo2". Users without existing access to "acme" will not be affected (they will still end up with only "foo" and "foo2").

  • [parentShareId] String optional

    If supplied, parentShareId is prepended to each ShareID before processing. The following two examples are equivalent. Example:

                 a. {"shareIds":"acme/foo", ...} => "acme/foo"
    
                 b. {"parentShareId":"acme",
                     "shareIds":"foo", ...} => "acme/foo"
  • [password] String optional

    Password to use when logging in to Share911.

  • [firstname] String optional

    Given name. Alias: first, first_name, first name

  • [lastname] String optional

    Surname/family name. Alias: last, last_name, last name

  • [title] String optional

    Job title. Alias: Job Title, job_title

  • [shift] String optional

    Assigned work shift.

  • [deleteMobileWhenEmpty] Boolean optional

    True if existing mobile number should be removed when a blank number is passed in. Default: false

  • [mobile] String optional

    Mobile phone number. Used when sending text messages. Alias: PhoneNumber, phone_number

  • [employeeId] String optional

    Unique employee identification number. Alias: EmployeeNumber, employee_number, employee_id

  • [managerIds] Array.string | String optional

    Manager's employee identification numbers. Alias: ManagerId, manager_id, manager_ids, ManagerEmployeeNumber, manager_employee_number

  • [contactName] String optional

    Emergency contact's name.

  • [contactPhone] String optional

    Emergency contact's phone number.

  • [contactEmail] String optional

    Emergency contact's email address.

Returns:

Object:

Response body follows the JSend format, as found here: http://labs.omniti.com/labs/jsend

Example Responses:

{
  statusCode: 200,
  headers: {'Content-Type': 'application/json'},
  body: {
    status: "success",
    data: {
      id: "XuBhoX3rtS6ADmYyD"   // Share911-assigned id of new or updated user
    }
  }
}

{
  statusCode: 403,
  headers: {'Content-Type': 'application/json'},
  body: {
    status: "error",
    message: "Access denied"
  }
}