POST /api/users

Allows the Site Admin to add a new user to the platform.

Note: When the Site Admin adds the user, an email notification is generated and sent to the user. The notification contains a link, which includes a registration code. The user can click this link to complete the signup process via the user interface. This step can be done via the API by invoking the POST /api/login/validateRegistrationCode operation. The Site Admin must convey the password to the user out of band.

If the default user workflow is in use, when the user logs in for the first time, a notification is sent to Site Admins and also to API Admins for any APIs the user is associated with (for example, if the user was automatically added to an app team via custom workflow, any APIs the app is associated with).

Authorization Roles/Permissions: Must be logged in. Site Admin only.

This topic includes the following sections:

HTTP Method

POST

URL

https://{hostname}/api/users

Sample Request

The example below shows a request to add a user.

Sample Request URL

https://{hostname}/api/users

Sample request headers

Accept: application/json
Content-Type: application/json
X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body #1

This example shows the platform default, without phone numbers.

{
  "FirstName":"Jonathan",
  "LastName":"Swift",
  "Email":"jswift@acmepaymentscorp.com",
  "Password":"Jonathan23",
  "ForcePasswordChangeOnLogin":"false"
}

Sample request body #2

In the example below, country codes are enabled on the platform. In this scenario, the Site Admin must add phone number information for the user.

{
  "FirstName":"Jane",
  "LastName":"Mead",
  "Email":"jmead@acmepaymentscorp.com",
  "UserPhones":{
    "UserPhone":[
      {
        "CountryCode":"+1",
        "PhoneNumber":"1234567890"
      }
    ]
  },
  "Password":"janemead_",
  "ForcePasswordChangeOnLogin":"false"
}

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept application/json, application/xml, application/vnd.soa.v71+json, application/vnd.soa.v71+xml, application/vnd.soa.v72+json, application/vnd.soa.v72+xml, application/vnd.soa.v80+json, application/vnd.soa.v80+xml, application/vnd.soa.v81+json, application/vnd.soa.v81+xml
Content-Type

Any one of the following media types is valid for the request Content-Type:

application/json, application/vnd.soa.v71+json, application/vnd.soa.v72+json, application/vnd.soa.v80+json, application/vnd.soa.v81+json

Cookie AtmoAuthToken_{fedmemberid}={cookie value, which usually starts with TokenID}—The platform cookie. This is the Akana API Platform authorization token, and must be sent with every API request that requires login. For more information and an example, see Session cookies.
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Request Parameters

Parameter Parm Type Data Type Required Description
User Body User Required

Contains information about a platform user.

FirstName, LastName, and Email are required. If Password is not specified, the platform auto-generates a password.

If needed, specify ForcePasswordChangeOnLogin to force the user to choose a new password.

Note: AcceptedAgreementID is not allowed in the request.

Response

If successful, this operation returns HTTP status code 200, with information about the new user.

Sample Response

The sample responses below shows successful completion of this operation.

Sample response headers #1: application/json

HTTP/1.1 200 OK
Date: Fri, 02 Dec 2016 19:32:43 GMT
Content-Type: application/json

Sample response body #1: application/json

Platform default, without phone numbers.

{
  "UserID" : "09c781ff-ff73-47a3-83d1-b2ced75fdf2d.acmepaymentscorp",
  "FirstName" : "Jonathan",
  "LastName" : "Swift",
  "Password" : "Jonathan23",
  "Email" : "jswift@acmepaymentscorp.com",
  "Language" : [ ],
  "Technology" : [ ],
  "AvatarProvider" : "com.soa.imageprovider.type.default",
  "State" : "registered",
  "AcceptedAgreementID" : [ ],
  "ForcePasswordChangeOnLogin" : false,
  "ExpirationDate" : "2017-01-01T11:32:43.628-08:00"
}

Sample response headers #2: application/json

Status Code: 200 OK
Content-Type:  application/json
Date: Fri, 09 Feb 2018 21:58:38 GMT

Sample response body: application/json

With phone numbers.

{
  "UserID":"9e2a84dc-d77a-42f8-9528-0eda2ccad5fd.acmepaymentscorp",
  "FirstName":"Jane",
  "LastName":"Mead",
  "Password":"janemead_",
  "Email":"jmead@acmepaymentscorp.com",
  "Language":[
  ],
  "Technology":[
  ],
  "AvatarProvider":"com.soa.imageprovider.type.default",
  "State":"registered",
  "AcceptedAgreementID":[
  ],
  "ForcePasswordChangeOnLogin":false,
  "ExpirationDate":"2018-03-11T14:58:32.465-07:00",
  "UserPhones":{
    "UserPhone":[
      {
        "CountryCode":"+1",
        "PhoneNumber":"1234567890"
      }
    ]
  }
}

Sample response headers #3: application/json

HTTP/1.1 200 OK
Date: Thu, 31 May 2018 23:22:38 GMT
Content-Type: application/json

Sample response body #3: application/json

With lifecycle integration enabled for users.

{
  "classifiers" : {
  },
  "artifacts" : {
  },
  "UserID" : "b9e29946-f71f-453b-9ed3-7823313240ad.acmepaymentscorp",
  "FirstName" : "Jane",
  "LastName" : "Mead",
  "Password" : "Sierra23",
  "Email" : "jmead@acmepaymentscorp.com",
  "Language" : [ ],
  "Technology" : [ ],
  "AvatarProvider" : "com.soa.imageprovider.type.default",
  "State" : "registered",
  "AcceptedAgreementID" : [ ],
  "ForcePasswordChangeOnLogin" : false,
  "ExpirationDate" : "2018-06-30T16:22:36.355-07:00"
}

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type application/json, application/xml, application/vnd.soa.v71+json, application/vnd.soa.v71+xml, application/vnd.soa.v72+json, application/vnd.soa.v72+xml, application/vnd.soa.v80+json, application/vnd.soa.v80+xml, application/vnd.soa.v81+json, application/vnd.soa.v81+xml

Response Body

Name Type Description
User User Contains information about a platform user.

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
400 Bad request: Returned if the client sends a malformed request; for example, invalid parameters or body content.For example, you might get this response if you did not specify the content-type for the request, specified an incorrect content-type, or did not have the correct information in the request body (POST content).
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
405

Method Not Allowed. You might get this if there is an error in the URL, or if you used the wrong HTTP verb.

You would also get this if you used the wrong HTTP verb, such as PUT instead of POST.

500 An error occurred processing the call.

More information about Akana API Platform API error messages.