|
| 1 | +# Admin |
| 2 | + |
| 3 | +## What (and why) are Admin Routes? |
| 4 | + |
| 5 | +The `admin` routes are helper endpoints created to assist staff with day-to-day workflow tasks, such as check-ins and payments. While these tasks can be achieved using other existing endpoints, `admin` routes are always set in the context of a staff member so any information returned is pertinent to the logged-in user (Staff Member). |
| 6 | + |
| 7 | +## Admin View |
| 8 | + |
| 9 | +```shell |
| 10 | +curl "https://api.runara.com/admin" |
| 11 | + -H "Authorization: Bearer:your.jwt.token" |
| 12 | +``` |
| 13 | + |
| 14 | +> The above command returns JSON structured like this: |
| 15 | +
|
| 16 | +```json |
| 17 | +{ |
| 18 | + "meta" : { |
| 19 | + "accounts" : [ |
| 20 | + { |
| 21 | + "id" : "sd5763ce9a89201a8f515fa4", |
| 22 | + "name" : "ABC and Co.", |
| 23 | + "role" : "staff" |
| 24 | + }, |
| 25 | + { |
| 26 | + "id" : "335763ce9a89203a8f515fd0", |
| 27 | + "name" : "Curves on South", |
| 28 | + "role" : "staff" |
| 29 | + } |
| 30 | + ], |
| 31 | + "current_account" : [ |
| 32 | + { |
| 33 | + "id" : "sd5763ce9a89201a8f515fa4", |
| 34 | + "name" : "ABC and Co.", |
| 35 | + "role" : "staff" |
| 36 | + } |
| 37 | + ] |
| 38 | + }, |
| 39 | + "data": [ |
| 40 | + { |
| 41 | + "id": "5976940e9a81200a4f10c363", |
| 42 | + "session_id": "5959bdce1a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800", |
| 43 | + "name": "Insanity Level 1", |
| 44 | + "type": "class", |
| 45 | + "item_id": "5959bdce1a892041711c4a2a", |
| 46 | + "date": "July 25th at 12:30pm", |
| 47 | + "timestamp": 1500985800, |
| 48 | + "duration": "60 minutes", |
| 49 | + "timespan": "12:30pm - 1:30pm", |
| 50 | + "clients": [ |
| 51 | + { |
| 52 | + "id": "595b06a91a89204afc2fb2c4", |
| 53 | + "booking_id": "5959bdce9a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800", |
| 54 | + "name": "Nestor DuBuque", |
| 55 | + "payment_status": { |
| 56 | + "status": 1, |
| 57 | + "description": "Paid - Credit Card" |
| 58 | + }, |
| 59 | + "payment_amount": "24.00", |
| 60 | + "checked_in": false |
| 61 | + }, |
| 62 | + { |
| 63 | + "id": "595b06a81a89204afe458627", |
| 64 | + "booking_id": "5959bdce9a891041711c4a2a-5959bdce9a892041711c4a2d-1500985800", |
| 65 | + "name": "Kenyon Hartmann", |
| 66 | + "payment_status": { |
| 67 | + "status": 0, |
| 68 | + "description": "Unpaid - Pay at checkin" |
| 69 | + }, |
| 70 | + "payment_amount": "24.00", |
| 71 | + "checked_in": false |
| 72 | + } |
| 73 | + ], |
| 74 | + "account": { |
| 75 | + "id": "5940b4a81a892006485be28b", |
| 76 | + "name": "Curves2Go" |
| 77 | + }, |
| 78 | + "staffed_by": { |
| 79 | + "id": "594c6d7f1a8920785c0e25e8", |
| 80 | + "name": "Michael Wuori" |
| 81 | + }, |
| 82 | + "location": { |
| 83 | + "id": "5940b6251a892006485be2bd", |
| 84 | + "name": "Suburbia", |
| 85 | + "room": "Studio A" |
| 86 | + }, |
| 87 | + "capacity": 25, |
| 88 | + "total_clients": 2, |
| 89 | + "total_checkins": 0 |
| 90 | + } |
| 91 | + ] |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +If logged-in as a staff member, returns upcoming bookings staff accounts. |
| 96 | + |
| 97 | +<aside class="notice"> |
| 98 | +This endpoint should only be used by staff members. Non staff members will not receive any results from this endpoint. |
| 99 | +</aside> |
| 100 | + |
| 101 | +### HTTP Request |
| 102 | + |
| 103 | +`GET https://api.runara.com/admin` |
| 104 | + |
| 105 | + |
| 106 | +## Switch Accounts |
| 107 | + |
| 108 | +```shell |
| 109 | +curl "https://api.runara.com/admin/switch/{ID}" |
| 110 | + -H "Authorization: Bearer:your.jwt.token" |
| 111 | +``` |
| 112 | + |
| 113 | +Switches the current account of the user, provided the user has access to the account. |
| 114 | + |
| 115 | +<aside class="warning"> |
| 116 | +User must have access to the account before switching to it. If they do not, a `401` response is returned. |
| 117 | +</aside> |
| 118 | + |
| 119 | +### HTTP Request |
| 120 | + |
| 121 | +`GET https://api.runara.com/admin/switch/{ID}` |
| 122 | + |
| 123 | +### URL Parameters |
| 124 | + |
| 125 | +Parameter | Required | Description | Example |
| 126 | +--------- | -------- | ----------- | ----------- |
| 127 | +ID | true | ID of account to switch to. | `568b55febffebc91068d4579` |
0 commit comments