From 1e0b34ed0ab90ca4a879099a1c9f4c0ad8c018a3 Mon Sep 17 00:00:00 2001 From: Philip Zhuravlenko Date: Mon, 21 May 2018 15:17:30 +0100 Subject: [PATCH 1/2] Added main info for Admin administrator endpoint.Responses yet to follow --- docs/rest-api/Administrator.md | 293 +++++++++++++++++++++++++++++++++ 1 file changed, 293 insertions(+) create mode 100644 docs/rest-api/Administrator.md diff --git a/docs/rest-api/Administrator.md b/docs/rest-api/Administrator.md new file mode 100644 index 0000000..7a36d2f --- /dev/null +++ b/docs/rest-api/Administrator.md @@ -0,0 +1,293 @@ +# 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://apidemo.bookingbug.com/api/v1/admin/37003/administrators?page=1&per_page=30' \
+-H 'Cache-Control: no-cache' \
+-H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+-H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+-H 'content-type: application/json'
+  ```
+
+
+
+
+```
+response here
+```
+
+
+
+
+ +## Read Administrator + + +
+ + +
+
+
+```
+curl -X GET \
+  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
+  -H 'Cache-Control: no-cache' \
+  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+  -H 'content-type: application/json'
+  ```
+
+
+
+
+```
+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://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
+-H 'Cache-Control: no-cache' \
+-H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+-H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+-H 'content-type: application/json'
+```
+
+
+
+
+```
+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://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
+  -H 'Cache-Control: no-cache' \
+  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+  -H 'content-type: application/json' \
+  -d '{
+	"name": "John Smith",
+	"role": "admin",
+	"reference": "new_external_reference"
+}'
+```
+
+
+
+
+```
+response here
+```
+
+
+
+
+ +## Find By Ref Administrator + +
+ +
+
+
+```
+curl -X GET \
+  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/find_by_ref/new_external_reference \
+  -H 'Cache-Control: no-cache' \
+  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+  -H 'content-type: application/json' \
+```
+
+
+
+
+```
+response here
+```
+
+
+
+
+ +## Delete Administrator + +
+ +
+
+
+```
+curl -X DELETE \
+  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
+  -H 'Cache-Control: no-cache' \
+  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
+  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+  -H 'content-type: application/json' \
+```
+
+
+
+
+```
+response here
+```
+
+
+
+
+ +The cURL below is an example that will return back all available slots for a given service, start date and an end date. + +
+ + +
+
+
+```
+  curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Content-Type: application/json"
+  -H "Cache-Control: no-cache"
+"https://{host}.bookingbug.com/api/v1/company_id/day_data?service_id=xxx&date=2016-13-12&edate=2016-20-12"
+  ```
+
+
+
+
+```
+response here
+```
+
+
+
+
+ +**Note:** We recommend that you use shorter date range for better performance. From 149df53d6ce719cdfed41ca44768341521d0b3ed Mon Sep 17 00:00:00 2001 From: waqasahmad Date: Wed, 23 May 2018 15:16:54 +0100 Subject: [PATCH 2/2] fixed the layout + more fixed the layout plus made the headers consistent and fixed the curl call that was not rendering properly --- docs/rest-api/Administrator.md | 214 +++++++++++++++------------------ 1 file changed, 94 insertions(+), 120 deletions(-) diff --git a/docs/rest-api/Administrator.md b/docs/rest-api/Administrator.md index 7a36d2f..33a2906 100644 --- a/docs/rest-api/Administrator.md +++ b/docs/rest-api/Administrator.md @@ -17,12 +17,13 @@ The LIST end-point will return a list of all administrators based on the company
 ```
 curl -X GET \
-'https://apidemo.bookingbug.com/api/v1/admin/37003/administrators?page=1&per_page=30' \
+ 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' \
--H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
--H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
--H 'content-type: application/json'
-  ```
+```
 
@@ -48,11 +49,12 @@ response here
 ```
 curl -X GET \
-  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
+  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' \
-  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
-  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
-  -H 'content-type: application/json'
   ```
 
@@ -72,43 +74,42 @@ 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
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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
    @@ -119,11 +120,12 @@ This is an example of how it is possible to create an Administrator account.
     ```
     curl -X GET \
    -https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
    --H 'Cache-Control: no-cache' \
    --H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
    --H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
    --H 'content-type: application/json'
    +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' \
     ```
     
@@ -144,33 +146,32 @@ Please proceed with caution and ensure that there is another admin who can admin #### Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDatatypeDescription
namestringName of the administrator (required when updating an administrator)
rolestringRole of the Administrator, "owner", "admin, "user", "callcentre"
referencestringExternal reference
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
namestringName of the administrator (required when updating an administrator)
rolestringRole of the Administrator, "owner", "admin, "user", "callcentre"
referencestringExternal reference
    @@ -181,11 +182,12 @@ Please proceed with caution and ensure that there is another admin who can admin
     ```
     curl -X PUT \
    -  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
    -  -H 'Cache-Control: no-cache' \
    -  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
    -  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
    +  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",
    @@ -215,11 +217,12 @@ response here
     
     ```
     curl -X GET \
    -  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/find_by_ref/new_external_reference \
    -  -H 'Cache-Control: no-cache' \
    -  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
    -  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
    +  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' \
     ```
     
@@ -244,11 +247,12 @@ response here
 ```
 curl -X DELETE \
-  https://apidemo.bookingbug.com/api/v1/admin/37003/administrators/12 \
-  -H 'Cache-Control: no-cache' \
-  -H 'app-id: c2dc0990f7a7d42078547c650ad0c02d96c07accbe6d' \
-  -H 'auth-token: _NfZCPvjOGZdhglZt15n7Q' \
+  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' \
 ```
 
@@ -261,33 +265,3 @@ response here - -The cURL below is an example that will return back all available slots for a given service, start date and an end date. - -
- - -
-
-
-```
-  curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Content-Type: application/json"
-  -H "Cache-Control: no-cache"
-"https://{host}.bookingbug.com/api/v1/company_id/day_data?service_id=xxx&date=2016-13-12&edate=2016-20-12"
-  ```
-
-
-
-
-```
-response here
-```
-
-
-
-
- -**Note:** We recommend that you use shorter date range for better performance.