User onboarding flow: Units
An example flow for creating a user and their first order.
1. Create a new user
Follow the instructions from the User onboarding flow article to create and authenticate as a user.
NOTE: This step can also be completed after step 2, once the user has selected a site and unit type they want to book.
2. Display site/unit type information
Use the GET /v1/settings
endpoint to load settings that reflect what you have configured in your admin interface. This will include details of the sites you have set up and the unit types configured for each site. Use the information here to display sites and then the available unit types to the user.
Example request
GET /v1/settings Content-Type: application/json;charset=UTF-8
Example response
200 OK { "sites": [ { "id": "5d4a11d101df89001735cb25", "title": { "en": "Central" }, "code": "central",<br> "unitTypes": [ { "id": "5d48410ad0823a00173dfb1e", "title": { "en": "Small" }, "code": "small", "price": 100, ... } ], "availability": { "5d48410ad0823a00173dfb1e": { "total": 100, "available": 3 }, ... } ... } ] }
3. Submit a unit order
Once a user has selected a site and the unit type they want to book, you can use this information to submit a unit order, which will create a move-in job to be handled in the management/admin portal:
Example request
POST /v1/units/orders Authorization: Bearer 380afb97ced808<br>Content-Type: application/json;charset=UTF-8 { "siteId": "5d4a11d101df89001735cb25", "unitTypeId: "5d48410ad0823a00173dfb1e", "startDate": "2019-08-01" }
Example response
200 OK