4.2.1. Admin API Wrapper¶
-
class
wsapiwrapper.admin.
AdminApiWrapper
(baseurl: str, tokenstr: str, endpoint_one: str, endpoint_many: str)[source]¶ Wraps calls to the wsbackend Admin API
The Admin API is intended for administrators.
-
__init__
(baseurl: str, tokenstr: str, endpoint_one: str, endpoint_many: str)[source]¶ Constructor for AdminApiWrapper
- Parameters
baseurl (str) – Websensor backend URL.
adminapi_client_id (str) – Client ID API access credential. A long base64 string e.g. SVpP…kO8
adminapi_client_secret (str) – Client Secret API access credential. A long base64 string e.g. CM300…1aVB
endpoint_one (str) – Endpoint for returning one resource instance.
endpoint_many (str) – Endpoint for returning a list of resource instances.
-
delete
(id: int)[source]¶ Make a DELETE request to the Tag endpoint.
- Parameters
id (int) – ID of the resource to delete
-
-
wsapiwrapper.admin.
request_admin_token
(baseurl: str, adminapi_client_id: str, adminapi_client_secret: str) → str[source]¶ Request a token from the token endpoint.
A client_id and client_secret are exchanged for a token. This uses the OAuth Client Credentials flow:
A POST request is made to the token endpoint of wsbackend.
Client ID and Client Secret are validated.
Access token is returned.
- Returns
token received from wsbackend.
- Return type