-
Notifications
You must be signed in to change notification settings - Fork 0
Sign up
In order to register a new user you need to send an email and a password to the API. An example HTTP-Request would look like to following:
POST /user/ HTTP/1.1
Content-Type: application/json
Host: yourdomain.org
Connection: close
Content-Length: 53
{"email":"[email protected]","password":"password"}
The server would then respond with 201 Created
if successful. An error response would be send back if either the email is already is use or email/password are missing. An example response after successfully creating a user could look like the following:
{
"password": null,
"firstname": null,
"lastname": null,
"email": "[email protected]",
"gender": null,
"id": 2,
"participant": null,
"profilePic": {
"id": 3,
"type": "IMAGE",
"uploadToken": "eyJ0eXAiOiJKVdQiLCJhbGc2OiJIUzUxMiJ9.eyJzdWJqZWN0IjoiMyJ9.eH3J3WNmiDy6xuNidDdzFCuuuV3P2oLbOsvpTr1xocK1JZouarEx2jzEpoaIs_V2FRsgrRftOwFBLdfrA-_aNw",
"sizes": []
},
"blocked": true
}
As one can see, the user is currently blocked, meaning that he can't do anything until he confirms his registration by clicking on the link in the registration email. This registration email will be sent to the email provided for the user. Information that is not yet entered will be returned as null
, as well as the password field, which will always be null
The uploadTokens in profilePic will authorize you to upload your profile image at the Uploader-Service. See detailed instructions here: Media
Activating the account of a user will normally be done by clicking the activation link in the email. This link would be of the following form:
GET http://yourdomain.org/activation?token=tokenfromtheemail&[email protected]
Becoming a participant is done by modifying the users data. An example HTTP Request, which adds a first- and lastname to the user and makes him a participant is shown below. Keep in mind that for this action, you need the users id in the url and you need to be authenticated, as described in Authentication
PUT /user/YOURUSERSID/ HTTP/1.1
Authorization: Bearer YOURAUTHENTICATIONTOKEN
Content-Type: application/json
Host: yourdomain.org
Connection: close
Content-Length: 107
{"firstname":"Jon","lastname":"Doe","participant":{"emergencynumber":"12345","tshirtsize":"XL"}}