Created User Registration API (markdown)

Tom Bloor 2017-04-22 18:38:51 +01:00
parent d099679ef6
commit bdadaeb440

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