diff --git a/docs/rest-api/Administrator.md b/docs/rest-api/Administrator.md new file mode 100644 index 0000000..33a2906 --- /dev/null +++ b/docs/rest-api/Administrator.md @@ -0,0 +1,267 @@ +# Administrator + +Purpose of this API endpoint is to create / update / find an administrator for a company. This will allow access to manipulate all of the Business entities in Bookingbug as an administrator. Use-cases for the use of this api endpoint include member of staff rotation / access change requests and access terminations. This api endpoint allows functions such as: list, read, create, update, delete and find_by_ref. +This is an admin API endpoint and to make any changes, it is necessary to authenticate as an existing administrator and use the auth-token to run any of the API calls below. The details on how to do this can be viewed on the authentication page. + +## List Administrators + +The LIST end-point will return a list of all administrators based on the company id that was passed in the URL parameter. + +
+```
+curl -X GET \
+ https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators?page=1&per_page=30 \
+-H 'App-id: {app-id}' \
+-H 'App-key: {app-key}' \
+-H 'auth-token: {auth-token}' \
+-H 'content-type: application/json' \
+-H 'Cache-Control: no-cache' \
+```
+
+ +``` +response here +``` ++
+```
+curl -X GET \
+ https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators/12 \
+ -H 'App-id: {app-id}' \
+ -H 'App-key: {app-key}' \
+ -H 'auth-token: {auth-token}' \
+ -H 'content-type: application/json' \
+ -H 'Cache-Control: no-cache' \
+ ```
+
+ +``` +response here +``` ++
| Name | +Datatype | +Description | +
|---|---|---|
| name | +string | +Name of the administrator | +
| string | +Email of the administrator | +|
| role | +string | +Role of the Administrator, "owner", "admin, "user", "callcentre" | +
| password | +string | +Password_for_the_administrator | +
| password_confirmation | +string | +Password_for_the_administrator | +
+```
+curl -X GET \
+https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators/12 \
+ -H 'App-id: {app-id}' \
+ -H 'App-key: {app-key}' \
+ -H 'auth-token: {auth-token}' \
+ -H 'content-type: application/json' \
+ -H 'Cache-Control: no-cache' \
+```
+
+ +``` +response here +``` ++
| Name | +Datatype | +Description | +
|---|---|---|
| name | +string | +Name of the administrator (required when updating an administrator) | +
| role | +string | +Role of the Administrator, "owner", "admin, "user", "callcentre" | +
| reference | +string | +External reference | +
+```
+curl -X PUT \
+ https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators/12 \
+ -H 'App-id: {app-id}' \
+ -H 'App-key: {app-key}' \
+ -H 'auth-token: {auth-token}' \
+ -H 'content-type: application/json' \
+ -H 'Cache-Control: no-cache' \
+ -d '{
+ "name": "John Smith",
+ "role": "admin",
+ "reference": "new_external_reference"
+}'
+```
+
+ +``` +response here +``` ++
+```
+curl -X GET \
+ https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators/find_by_ref/new_external_reference \
+ -H 'App-id: {app-id}' \
+ -H 'App-key: {app-key}' \
+ -H 'auth-token: {auth-token}' \
+ -H 'content-type: application/json' \
+ -H 'Cache-Control: no-cache' \
+```
+
+ +``` +response here +``` ++
+```
+curl -X DELETE \
+ https://{host}.bookingbug.com/api/v1/admin/{company_id}/administrators/12 \
+ -H 'App-id: {app-id}' \
+ -H 'App-key: {app-key}' \
+ -H 'auth-token: {auth-token}' \
+ -H 'content-type: application/json' \
+ -H 'Cache-Control: no-cache' \
+```
+
+ +``` +response here +``` ++