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:
# | Scenario | Outcome | Expected Behavior | Status Code | Response |
---|---|---|---|---|---|
1 | The user service has receives a request without a user id | Success | The user is created and the user id is automatically generated | 201 Created | Location Header: UserId |
2 | The user service has receives a request with a user id | Success | The user is created with the specified user id | 201 Created | Location Header: UserId |
3 | The user service has receives a request without a display name | BadRequest | The user is not created and a bad request response is returned | 400 Bad Request | ErrorResponse: Missing data – display name is required. |
4 | The user service has receives a request without a surname | BadRequest | The user is not created and a bad request response is returned | 400 Bad Request | ErrorResponse: Missing data – surname is required. |
5 | The user service receives a user id that is already is use | Fail | The user is not created and an internal server response is returned | 500 Internal server errror | ErrorResponse: 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"
}
}
}