7 User Registration API
Finn edited this page 2017-08-25 15:56:57 +01:00

User Registration API

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)>,
  display_name : <preferred user name>,
  full_name : <customer full name>,
  postcode : <customer postcode>,
  year_of_birth : <customer year of birth>,
  password : <password (used for login)>
}

Where year_of_birth is between 10 and 150 years in the past.

Organisation Registration

{
  token : <signup token>,
  usertype : 'organisation',
  email : <email (used for login)>,
  name : <organisation name>,
  street_name : <organisation street address>,
  town : <organisation village/town/city>,
  sector : <sector area code>,
  postcode : <organisation postcode>,
  password : <password (used for login)>
}

Where the sector area code letter is based off the ONS UK SIC 2007 classifications shown here, which is broken down to the list below.

  • A for: Agriculture, Forestry & Fishing
  • B for: Mining & Quarrying
  • C for: Manufacturing
  • D for: Electricity, Gas, Steam & Air Conditiioning
  • E for: Water & Waste Management
  • F for: Construction
  • G for: Wholesale & Retail Trade
  • H for: Transportation & Storage
  • I for: Accomodation & Food Services
  • J for: Information & Communication
  • K for: Financial & Insurance Activities
  • L for: Real Estate
  • M for: Professional, Scientfic & Technical
  • N for: Administrative & Support Services
  • O for: Public Administration, Defence & Social Security
  • P for: Education
  • Q for: Human Health & Social Work
  • R for: Arts, Entertainment & Recreation
  • S for: Other Service Activities
  • T for: Household Domestic Business

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