This repository was archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
User registration
Michał B edited this page Nov 11, 2018
·
1 revision
- Available at URI:
http://localhost:5000/user-management/users
- Type of success response:
201 Created with user data
- Type of error response:
400 with error message
- HTTP method type:
POST
- The data is sent in JSON format.
- Request body consists of:
-
nick:
string
that must match the regular expression -
login:
ulong
representing the login hash, parsed to thestring
format -
password:
ulong
representing the password hash, parsed to thestring
format -
userEmail:
ulong
representing the user email hash, parsed to thestring
format
-
nick:
Example of the valid JSON request body:
{
"nick": "BigBear256",
"login": "1232315685215976525",
"password": "1201300456785202340",
"userEmail": "1123224522563205642"
}
- If all data in JSON request are valid and user was successfully created, then WebAPI returns
201 Created
with user who has just been created:
{
"userEmail": 3458618104525265484,
"userImage": null,
"id": 6,
"nick": "BigBear256",
"login": 4167459186499150703,
"salt": "1xegbo+6boGt3QOdZzWxZQI4X4cDROuG7dELxmTfYsSl+vv1j4h9Rj+Wb0yBhGUfln+xGLsGjE4sHr8GWdh8axRsnqXdNUl/KBwol4JC5jgTDmVFZZNZ5obN/H6vWedRLqxhWlRILRObKZwcWNg2AI0ILo974BvXSOKQxxvpH80=",
"passwordHash": "2t+kuXSQlw/3lX/3+syiZSMkPNOLY1kwXc4ipN8Vz3sn+Y5gfONtLn0zghzbIbYC2zxmdQ+F0w3or6+sgYZ5Vg==",
"role": "user",
"restoreKey": "C@ry0?5!jZ@F",
"createdAt": "2018-08-04T08:50:52.0223276Z"
}
It also returns headers, with one of them is a relative path to the new resource: Location →/users/6
- If data aren't valid or user already exists, the WebAPI returns
400 Bad Request
with error message.
For example, when the WebAPI receives not valid data:
{
"Nick": [
"Nick must starts with the letter and can contains only letters and digits."
],
"Login": [
"The length of 'Login' must be 20 characters or fewer. You entered 21 characters.",
"Invalid value!"
],
"Password": [
"The length of 'Password' must be 20 characters or fewer. You entered 21 characters.",
"Invalid value!"
],
"UserEmail": [
"The length of 'User Email' must be 20 characters or fewer. You entered 21 characters.",
"Invalid value!"
]
}