Example: Adding a User

This example walks you through adding a user to the Akana API Platform by using the API rather than the user interface. Only a Site Admin can perform this task.

This exercise assumes that you already have a valid login for the Akana API Platform and are a Site Admin.

Essentially, you'll just need to provide basic user information and run the operation.

Upon login, the new user will be required to complete one or more additional steps:

  1. Change password (if ForcePasswordChangeOnLogin is set to true in the request body, Step 2 below).
  2. Accept legal agreement (if a platform legal agreement is set up).
  3. Provide answer to user security challenge questions, if applicable.

Follow the detailed instructions below.

To add a user in the Akana API Platform using the API

  1. Log in via the API, POST /api/login operation, using your own email and password in the body of the operation instead of the placeholder values given below.
    • HTTP method: POST
    • URL: https://{hostname}/api/login
    • Accept header: application/json
    • Content-Type header: application/json
    • Request Body:
      {
        "email":"MyEmailAddress",
        "password":"MyPassword"
      }

    The platform API returns the login cookie, which you'll need to send with the request headers for any operation that requires login, and the CSRF cookie, which you'll need to use to put together the CSRF header if required by platform settings (not covered in this exercise: see Example: Using the CSRF header).

  2. Add the user, using the POST /api/users operation. In your API call, use the request body as shown below, and fill in valid values for the new user. Make sure the temporary password meets the password rules.
    • HTTP method: POST
    • URL: https://{hostname}/api/users
    • Content-Type header: application/json
    • CSRF header: include it if needed. If you are not sure whether it's needed or not, refer to CSRF Prevention on the Platform.
    • Request Body:
      {
        "FirstName":"TemporaryFirstName",
        "LastName":"TemporaryLastName",
        "Email":"useremail@example.com",
        "Password":"TemporaryPassword"
        "ForcePasswordChangeOnLogin":"false"
      }
  3. When done, remember to log out using the GET /api/login/endsession operation. Use the following values:
    • URL: https://{hostname}/api/login/endsession
    • Accept header: application/json