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
+```
+
+
+
+
+ +## Read 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
+```
+
+
+
+
+ +## Create an Administrator + +This is an example of how it is possible to create an Administrator account. + +#### Parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
namestringName of the administrator
emailstringEmail of the administrator
rolestringRole of the Administrator, "owner", "admin, "user", "callcentre"
passwordstringPassword_for_the_administrator
password_confirmationstringPassword_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
+```
+
+
+
+
+ + +## Update Administrator + +Please proceed with caution and ensure that there is another admin who can administer the company at the right permission level, otherwise there is a risk that the admin who's access is being updated could get locked out. + +#### Parameters + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
namestringName of the administrator (required when updating an administrator)
rolestringRole of the Administrator, "owner", "admin, "user", "callcentre"
referencestringExternal 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
+```
+
+
+
+
+ +## Find By Ref Administrator + +
+ +
+
+
+```
+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
+```
+
+
+
+
+ +## Delete Administrator + +
+ +
+
+
+```
+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
+```
+
+
+
+