From bdadaeb44073d843f71036b54d57f04c4ef99041 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Sat, 22 Apr 2017 18:38:51 +0100 Subject: [PATCH] Created User Registration API (markdown) --- User-Registration-API.md | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 User-Registration-API.md diff --git a/User-Registration-API.md b/User-Registration-API.md new file mode 100644 index 0000000..6a2e3c2 --- /dev/null +++ b/User-Registration-API.md @@ -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 : , + usertype : 'customer', + email : , + username : , + postcode : , + age : +} +``` + +#### Organisation Registration + +``` +{ + token : , + usertype : 'customer', + email : , + username : , + street_name : , + town : , + 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 : +} +``` + +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 \ No newline at end of file