User onboarding flow

Notes

  • URLs in example requests should be prepended with your base API URL which you will receive on signup. So for example /v1/users should actually be something like https://<your-business>-api.storeganise.com/v1/users  
  • All data sent to the API in the request body should be in JSON format.  All responses are in JSON format too.
  • The below serves as a general guide to get started but you can also use the default customer-facing valet portal that will be set up for you as reference. By monitoring requests in the browser's developer tools you can see what is sent to the Storeganise API and what comes back, and how to tie the different requests into your own custom application.

1. Create a new user

Example request

POST /v1/users
Content-Type: application/json;charset=UTF-8

{
  “email”: “john@example.com”, 
  “password”: “abc123”, 
  ”firstName”: “John”, 
  “lastName”: “Smith”
}

2. Authenticate as the created user by getting an access token

See https://en.wikipedia.org/wiki/Basic_access_authentication for more information).

The user's email and password should be base64 encoded, with the result being passed in the Authorization  header.  Encode them in the form email:password for example Base64(john@example.com:abc123)  

Example request:

POST /v1/auth/token
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

Example response

200 OK

{
  "accessToken": "380afb97ced808",  "user": {
    "firstName": "John",
    "lastName": "Smith",
    ...
  }
}

Also note that you can use the include query parameter to load in additional user info while getting the access token, e.g.:

POST /v1/auth/token?include=items,valetOrders,settings
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

From this point on requests to most endpoints need to include the access token in the Authorization  header, for example:

GET /v1/auth/userinfo?include=items,valetOrders,settings
Authorization: Bearer 380afb97ced808

3. Create an order

Example request

POST /v1/valet/orders
Authorization: Bearer 380afb97ced808
Content-Type: application/json;charset=UTF-8
{
  "date": "2018-01-01",
  "timeslot": "1000-1200",
  ...
}

Example response

200 OK

{
  "date": "2018-01-01",
  "timeslot": "1000-1200",
  ...
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us