Create a User

Service URL: POST /users

Request Body:

ICreateUserRequest

user – IUser – The user to be created

Response Headers:

Location: /users/{userId}

Remarks

Creates a user with a given display name and surname. The user id can be supplied to assign the user a specific userId, otherwise, the user id is generated.

Scenarios:

#ScenarioOutcomeExpected BehaviorStatus CodeResponse
1The user service has receives a request without a user idSuccessThe user is created and the user id is automatically generated201 CreatedLocation Header: UserId
2The user service has receives a request with a user idSuccessThe user is created with the specified user id 201 Created Location Header: UserId
3The user service has receives a request without a display nameBadRequestThe user is not created and a bad request response is returned400 Bad RequestErrorResponse: Missing data – display name is required.
4The user service has receives a request without a surnameBadRequestThe user is not created and a bad request response is returned400 Bad RequestErrorResponse: Missing data – surname is required.
5The user service receives a user id that is already is useFailThe user is not created and an internal server response is returned500 Internal server errrorErrorResponse: Failed to create user. User already exists.

Example Request

{
  "user" : {
    "displayName" : "james.hanson",
    "userId" : "1001",
    "isTemplate" : false,
    "address" : {
      "countryCodeId" : { },
      "typeId" : { },
      "county" : "Hertfordshire",
      "postCode" : "SG14 1PB",
      "street1" : "Enactor House",
      "street2" : "1 Bluecoats Avenue",
      "town" : "Hertford",
      "isTemplate" : false
    },
    "userName" : {
      "surname" : "Hanson"
    }
  }
}

Go to Top