Created User Registration API (markdown)
parent
d099679ef6
commit
bdadaeb440
1 changed files with 76 additions and 0 deletions
76
User-Registration-API.md
Normal file
76
User-Registration-API.md
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# User Registration API
|
||||||
|
|
||||||
|
_Last Updated 2017-04-22_
|
||||||
|
|
||||||
|
## `POST /api/register`
|
||||||
|
|
||||||
|
Takes a `application/json` payload. The JSON can be one of the following types:
|
||||||
|
|
||||||
|
* Customer Registration
|
||||||
|
* Organisation Registration
|
||||||
|
|
||||||
|
### Request JSON
|
||||||
|
|
||||||
|
#### Customer Registration
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
token : <signup token>,
|
||||||
|
usertype : 'customer',
|
||||||
|
email : <email (used for login)>,
|
||||||
|
username : <preferred user name>,
|
||||||
|
postcode : <customer postcode>,
|
||||||
|
age : <age range key>
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Organisation Registration
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
token : <signup token>,
|
||||||
|
usertype : 'customer',
|
||||||
|
email : <email (used for login)>,
|
||||||
|
username : <organisation name>,
|
||||||
|
street_name : <organisation street address>,
|
||||||
|
town : <organisation village/town/city>,
|
||||||
|
postcode : <organisation postcode>
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Response JSON
|
||||||
|
|
||||||
|
#### Success
|
||||||
|
|
||||||
|
Response code of `200 OK`
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
success : true,
|
||||||
|
message : 'Registered Successfully'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Failure
|
||||||
|
|
||||||
|
If something is missing from the request, or is invalid, you will get a response code of `400 BAD REQUEST` and the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
success : false,
|
||||||
|
message : <error message>
|
||||||
|
error : <error type>
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If there was a server error, you will get a `500 SERVER ERROR` and possibly the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
success : false,
|
||||||
|
message : 'An unknown error occurred when adding the transaction'
|
||||||
|
error : 'server_error'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The error messages should describe what was wrong with the submission
|
Reference in a new issue