TIS Training API Documentation
  • Welcome!
  • Quick Start
  • Managing Users
  • Single Sign On (SSO)
    • General Options
    • Role and Group Mappings
    • Connection Types
      • Microsoft Entra ID (Formerly Azure AD)
      • Google Workspace
      • OpenID Connect (OIDC)
      • SAML (Security Assertion Markup Language)
  • SCORM Packages
  • Webhooks
  • API Reference
    • Users
      • 🔵GET users
      • 🔵GET users/seats
      • 🟢POST users
      • 🟠PUT users
      • 🟢POST users/password
      • 🟡PATCH users/enable
      • 🟡PATCH users/disable
      • 🔴DELETE users
    • Results
      • 🔵GET results
      • 🔵GET results/group
    • Groups
      • 🔵GET groups
      • 🟢POST groups/users
      • 🔴DELETE groups/users
    • 🔵GET courses
    • 🔵GET filters
    • 🟢POST login
    • â›”Standard Error Format
  • Webhook Reference
    • Standard Structure
    • Course Complete
    • Multi-Course Complete
  • OpenAPI Specification
Powered by GitBook
On this page

Managing Users

PreviousQuick StartNextSingle Sign On (SSO)

Last updated 9 months ago

The TIS Training API provides a few endpoints for managing users programatically. Let's start with creating a user.

API created users can only be used with one organisation, and user emails must be unique across the entire TIS Training platform. If you have multiple TIS Training organisations and want the user to be able to join more than one, please use a different account creation method.

First, lets set an email to use for the new user:

TiSUserEmail=alicesmith@example.com

Choose an email you have access to, even if you plan on deleting the user later.

Let's create the new user with curl:

curl https://training.tapintosafety.com.au/api/v2/users \
    -H "Authorization: Bearer $APIKey"                  \
    -H "Content-Type: application/json"                 \
    -d '{ "email": "$TiSUserEmail",                     \
          "firstName": "Allice",                        \
          "lastName": "Smith" }

Now we can see Alice when we ask for a list of users in the organisation.

curl https://training.tapintosafety.com.au/api/v2/users \
    -H "Authorization: Bearer $APIKey"

Oops! We seem to have misspelt Alice's first name. Let's fix that with our next endpoint.

curl https://training.tapintosafety.com.au/api/v2/users \
    -X PUT                                              \
    -H "Authorization: Bearer $APIKey"                  \
    -H "Content-Type: application/json"                 \
    -d '{ "userIdentifier": "$TiSUserEmail",            \
          "email": "alicesmith@example.com",            \
          "firstName": "Alice",                         \
          "lastName": "Smith" }

You might have noticed that we haven't set a password for Alice yet. That's because this time we're going to generate a link to login automatically.

curl "https://training.tapintosafety.com.au/api/v2/login?userIdentifier=$TiSUserEmail"             \
    -X POST                               \
    -H "Authorization: Bearer $APIKey"    \
    -H "Content-Length: 0"

This call should just return a link that you can go to in any browser that will automatically log you into the account specified. Make sure you use the link as soon as it's generated, as it will expire quickly.

So maybe we've decided that Alice needs a password to log in after all. No problem, this brings us to the last endpoint we'll be covering here.

curl "https://training.tapintosafety.com.au/api/v2/users/Password?userIdentifier=$TiSUserEmail"             \
    -H "Authorization: Bearer $APIKey"    \
    -H "Content-Type: application/json"   \
    -d '{ "password": "ExamplePass1" }'

With that, Alice will be able to log in with the new password.

🟢POST users
🔵GET users
🟠PUT users
🟢POST login
🟢POST users/password