|
1 | 1 | # Admin |
2 | 2 |
|
3 | | -## What (and why) are Admin Routes? |
| 3 | +## What are Admin Routes? |
4 | 4 |
|
5 | 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 | 6 |
|
7 | 7 | ## Admin View |
8 | 8 |
|
9 | | -> Example Result: |
| 9 | +> Example Response: |
10 | 10 |
|
11 | 11 | ```json |
12 | 12 | { |
13 | | - "meta" : { |
14 | | - "accounts" : [ |
15 | | - { |
16 | | - "id" : "sd5763ce9a89201a8f515fa4", |
17 | | - "name" : "ABC and Co.", |
18 | | - "role" : "staff" |
19 | | - }, |
20 | | - { |
21 | | - "id" : "335763ce9a89203a8f515fd0", |
22 | | - "name" : "Curves on South", |
23 | | - "role" : "staff" |
24 | | - } |
25 | | - ], |
26 | | - "current_account" : [ |
27 | | - { |
28 | | - "id" : "sd5763ce9a89201a8f515fa4", |
29 | | - "name" : "ABC and Co.", |
30 | | - "role" : "staff" |
31 | | - } |
32 | | - ] |
33 | | - }, |
| 13 | + "meta": { |
| 14 | + "accounts": [ |
| 15 | + { |
| 16 | + "id": 100110, |
| 17 | + "name": "Body by Keelay", |
| 18 | + "role": "Administrator" |
| 19 | + }, |
| 20 | + { |
| 21 | + "id": 100111, |
| 22 | + "name": "5x5 Inc", |
| 23 | + "role": "Staff" |
| 24 | + } |
| 25 | + ], |
34 | 26 | "data": [ |
| 27 | + { |
| 28 | + "id": 477, |
| 29 | + "session_id": null, |
| 30 | + "name": "StrongLifts Introduction", |
| 31 | + "type": "Class", |
| 32 | + "item_id": 100118, |
| 33 | + "date": "August 28th at 8:00am", |
| 34 | + "timestamp": 1535457600, |
| 35 | + "duration": "30 minutes", |
| 36 | + "timespan": "8:00am - 8:30am", |
| 37 | + "clients": [ |
| 38 | + { |
| 39 | + "id": 100137, |
| 40 | + "booking_id": 477, |
| 41 | + "name": "Fatima Kuphal", |
| 42 | + "payment_status": 0, |
| 43 | + "payment_status_description": "Unpaid - Pay at Checkin", |
| 44 | + "payment_amount": "30.00", |
| 45 | + "checked_in": false, |
| 46 | + "photo": { |
| 47 | + "default": null, |
| 48 | + "thumb": null |
| 49 | + } |
| 50 | + } |
| 51 | + ], |
| 52 | + "account": { |
| 53 | + "id": 100110, |
| 54 | + "name": "Body by Keelay" |
| 55 | + }, |
| 56 | + "staffed_by": { |
| 57 | + "id": 100135, |
| 58 | + "name": "Trudie Kirlin", |
| 59 | + "photo": { |
| 60 | + "default": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg", |
| 61 | + "thumb": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg" |
| 62 | + } |
| 63 | + }, |
| 64 | + "location": { |
| 65 | + "id": 100118, |
| 66 | + "name": "Pineville", |
| 67 | + "room": null |
| 68 | + }, |
| 69 | + "capacity": 20, |
| 70 | + "total_clients": 1, |
| 71 | + "total_checkins": 0 |
| 72 | + }, |
| 73 | + { |
| 74 | + "id": 848, |
| 75 | + "session_id": null, |
| 76 | + "name": "Cut and Shampoo", |
| 77 | + "type": "Appointment", |
| 78 | + "item_id": 100111, |
| 79 | + "date": "August 28th at 10:30am", |
| 80 | + "timestamp": 1535466600, |
| 81 | + "duration": "105 minutes", |
| 82 | + "timespan": "10:30am - 12:15pm", |
| 83 | + "clients": [ |
35 | 84 | { |
36 | | - "id": "5976940e9a81200a4f10c363", |
37 | | - "session_id": "5959bdce1a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800", |
38 | | - "name": "Insanity Level 1", |
39 | | - "type": "class", |
40 | | - "item_id": "5959bdce1a892041711c4a2a", |
41 | | - "date": "July 25th at 12:30pm", |
42 | | - "timestamp": 1500985800, |
43 | | - "duration": "60 minutes", |
44 | | - "timespan": "12:30pm - 1:30pm", |
45 | | - "clients": [ |
46 | | - { |
47 | | - "id": "595b06a91a89204afc2fb2c4", |
48 | | - "booking_id": "5959bdce9a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800", |
49 | | - "name": "Nestor DuBuque", |
50 | | - "payment_status": { |
51 | | - "status": 1, |
52 | | - "description": "Paid - Credit Card" |
53 | | - }, |
54 | | - "payment_amount": "24.00", |
55 | | - "checked_in": false |
56 | | - }, |
57 | | - { |
58 | | - "id": "595b06a81a89204afe458627", |
59 | | - "booking_id": "5959bdce9a891041711c4a2a-5959bdce9a892041711c4a2d-1500985800", |
60 | | - "name": "Kenyon Hartmann", |
61 | | - "payment_status": { |
62 | | - "status": 0, |
63 | | - "description": "Unpaid - Pay at checkin" |
64 | | - }, |
65 | | - "payment_amount": "24.00", |
66 | | - "checked_in": false |
67 | | - } |
68 | | - ], |
69 | | - "account": { |
70 | | - "id": "5940b4a81a892006485be28b", |
71 | | - "name": "Curves2Go" |
72 | | - }, |
73 | | - "staffed_by": { |
74 | | - "id": "594c6d7f1a8920785c0e25e8", |
75 | | - "name": "Michael Wuori" |
76 | | - }, |
77 | | - "location": { |
78 | | - "id": "5940b6251a892006485be2bd", |
79 | | - "name": "Suburbia", |
80 | | - "room": "Studio A" |
81 | | - }, |
82 | | - "capacity": 25, |
83 | | - "total_clients": 2, |
84 | | - "total_checkins": 0 |
85 | | - } |
86 | | - ] |
| 85 | + "id": 100112, |
| 86 | + "booking_id": 848, |
| 87 | + "name": "Jamie Kihn", |
| 88 | + "payment_status": 1, |
| 89 | + "payment_status_description": "Paid - Cash", |
| 90 | + "payment_amount": "64.00", |
| 91 | + "checked_in": false, |
| 92 | + "photo": { |
| 93 | + "default": null, |
| 94 | + "thumb": null |
| 95 | + } |
| 96 | + } |
| 97 | + ], |
| 98 | + "account": { |
| 99 | + "id": 100110, |
| 100 | + "name": "Body by Keelay" |
| 101 | + }, |
| 102 | + "staffed_by": { |
| 103 | + "id": 100135, |
| 104 | + "name": "Trudie Kirlin", |
| 105 | + "photo": { |
| 106 | + "default": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg", |
| 107 | + "thumb": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg" |
| 108 | + } |
| 109 | + }, |
| 110 | + "location": { |
| 111 | + "id": 100116, |
| 112 | + "name": "123 Main", |
| 113 | + "room": null |
| 114 | + }, |
| 115 | + "capacity": null, |
| 116 | + "total_clients": 1, |
| 117 | + "total_checkins": 0 |
| 118 | + } |
| 119 | + ] |
| 120 | +} |
87 | 121 | } |
88 | 122 | ``` |
89 | 123 |
|
90 | 124 | If logged-in as a staff member, returns upcoming bookings staff accounts. |
91 | 125 |
|
92 | | -<aside class="notice"> |
93 | 126 | This endpoint should only be used by staff members. Non staff members will not receive any results from this endpoint. |
94 | | -</aside> |
95 | 127 |
|
96 | 128 | ### HTTP Request |
97 | 129 |
|
98 | 130 | `GET https://api.runara.com/admin` |
99 | 131 |
|
100 | | - |
101 | | -## Switch Accounts |
102 | | - |
103 | | -```shell |
104 | | -curl "https://api.runara.com/admin/switch/{ID}" |
105 | | - -H "Authorization: Bearer:your.jwt.token" |
106 | | -``` |
107 | | - |
108 | | -Switches the current account of the user, provided the user has access to the account. |
109 | | - |
110 | | -<aside class="warning"> |
111 | | -User must have access to the account before switching to it. If they do not, a `401` response is returned. |
| 132 | +<aside class="notice"> |
| 133 | +If logged-in as a manager or administrator, you can pass an optional staff ID in the request URL to view a particular staff member's bookings. Note: the `accounts` object will return empty as you are not allowed to view a staff member's associated accounts. |
112 | 134 | </aside> |
113 | 135 |
|
114 | | -### HTTP Request |
| 136 | +### HTTP Request for Specific Staff (admin-only) |
115 | 137 |
|
116 | | -`GET https://api.runara.com/admin/switch/{ID}` |
| 138 | +`GET https://api.runara.com/admin/{staff_id}` |
117 | 139 |
|
118 | | -### URL Parameters |
| 140 | +### Route Parameters |
119 | 141 |
|
120 | 142 | Parameter | Required | Description | Example |
121 | 143 | --------- | -------- | ----------- | ----------- |
122 | | -ID | true | ID of account to switch to. | `568b55febffebc91068d4579` |
| 144 | +ID | false | ID of staff to view. | `11234433` |
0 commit comments