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: Site Admin only.

This topic includes the following sections:

HTTP Method

POST

Back to top

URL

https://{hostname}/api/users

Back to top

Sample Request

The example below shows a request to add a user.

Request URL

https://{hostname}/api/users

Sample request headers

Accept: application/json
Content-Type: application/json
X-Csrf-Token_{tenant}: {TokenID}

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":"Mary",
  "LastName":"Martinson",
  "Email":"mmartinson@gmail.com",
  "UserPhones":{
    "UserPhone":[
      {
        "CountryCode":"+1",
        "PhoneNumber":"(123) 456-7890"
      }
    ]
  },
  "Password":"JaneMead23",
  "ForcePasswordChangeOnLogin":"false"
}

Back to top

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

X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform.

Back to top

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.

Back to top

Response

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

Back to top

Sample Response

The sample responses below shows successful completion of this operation.

Sample response headers #1: application/json

Platform default, without phone numbers.

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

With phone numbers.

Status Code: 200 OK
Content-Type:  application/json
Expires: Tue, 08 Sep 2015 13:54:32 GMT

Sample response body: application/json

With phone numbers.

{
  "UserID" : "8789eac3-227b-4956-a74e-65c706a65bb6.acmepaymentscorp",
  "FirstName" : "Jane",
  "LastName" : "Mead",
  "Password" : "JaneMead23",
  "Email" : "jmead@acmepaymentscorp.com",
  "Language" : [ ],
  "Technology" : [ ],
  "AvatarProvider" : "com.soa.imageprovider.type.default",
  "State" : "registered",
  "AcceptedAgreementID" : [ ],
  "ForcePasswordChangeOnLogin" : false,
  "ExpirationDate" : "2015-10-08T20:36:54.308Z",
  "UserPhones" : {
    "UserPhone" : [ {
      "CountryCode" : "+1",
      "PhoneNumber" : "1234567888"
    } ]
  }
}

Sample response headers #2: application/xml

Status Code: 200 OK
Content-Type:  application/xml
Expires: Tue, 08 Sep 2015 15:42:22 GMT

Sample response body: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<User xmlns="http://soa.com/xsd/user/1.0" xmlns:ns2="http://soa.com/xsd/business/1.0">
  <UserID>0182cc44-a358-409b-9787-4dbf95092fd3.acmepaymentscorp</UserID>
  <FirstName>Jane</FirstName>
  <LastName>Mead</LastName>
  <Password>JaneMead23</Password>
  <Email>jmead@acmepaymentscorp.com</Email>
  <AvatarProvider>com.soa.imageprovider.type.default</AvatarProvider>
  <State>registered</State>
  <ForcePasswordChangeOnLogin>false</ForcePasswordChangeOnLogin>
  <ExpirationDate>2015-10-08T20:42:22.886Z</ExpirationDate>
  <UserPhones>
    <UserPhone>
      <CountryCode>+1</CountryCode>
      <PhoneNumber>1234567888</PhoneNumber>
    </UserPhone>
  </UserPhones>
</User>

Back to top

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

Back to top

Response Body

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

Back to top

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 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.
405

Method Not Allowed. For example, you might get this if you specified an invalid Accept header or omitted a required Content-Type header.

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.

Back to top

Related Topics