Skip to main content

Creating and Managing Clients

info

This REST API documentation is effective as of 21:00 EST, 2 April, 2023.

Creating a Client

To create a client:

  1. Authenticate yourself: Go to the CertiScan Web App. Make sure you are signed in using your own account.

  2. Find the "Authorization" header: Open developer tools > Network request details in your browser. We will refer to this as the auth_token. Include the Bearer (with space) when you copy the auth_token, for example:

    auth_token = "Bearer 8EA3qNWLZBgPUexgE7TDKfWm77ozyi87cw8615vWz2k.54DGujYEh_VF8MPT1cMonzswp1P-OBIeDfXS7K8TfQA"
  3. Run the following script: Pass in the auth_token from the above steps, the subject value that we provided you with, and a secret passcode that you need to supply. Note that that you cannot retrieve the secret again after setting it, and that the secret is not your account password.

    import json
    import requests

    BASE_URL = "https://account.app.certiscan.cloud/api/v1/account/worktoken/"
    HEADERS_BASE = {'Content-Type': 'application/json'}

    def create_client(subject, secret, auth_token):
    headers = {**HEADERS_BASE, **{"Authorization": auth_token}}
    response = requests.post(
    BASE_URL,
    data=json.dumps({
    "name": "TestWorkToken", # Use an appropriate name for your client
    "subject": subject,
    "secret": secret,
    }),
    headers=headers
    )
    return response.json()

    A successful result will be similar to this:

    {
    "success": true,
    "result": {
    "subject": "8ade3b80-56c8-4593-8e51-5e98c5afbbbe",
    "name": "TestWorkToken"
    }
    }

Updating a Client

You can change two values: the name and the secret (only PUT is supported at this time).

import json
import requests
import urllib.parse

BASE_URL = "https://account.app.certiscan.cloud/api/v1/account/worktoken/"

HEADERS_BASE = {'Content-Type': 'application/json'}

def update_client(subject, secret, auth_token):
headers = {**HEADERS_BASE, **{"Authorization": auth_token}}
response = requests.put(
urllib.parse.urljoin(BASE_URL, "{}/".format(subject)),
data=json.dumps({
"name": "New Name",
"subject": subject,
"secret": secret,
}),
headers=headers
)
return response.json()

A successful result will be similar to this:

{
"success": true,
"result": {
"subject": "8ade3b80-56c8-4593-8e51-5e98c5afbbbe",
"name": "New Name"
}
}

Deleting a Client

Deleting a client will invalidate the tokens in use, but it will take some time for the cloud to cache and sync the change. Typically this happens within 5 minutes.

import json
import requests
import urllib.parse

BASE_URL = "https://account.app.certiscan.cloud/api/v1/account/worktoken/"
HEADERS_BASE = {'Content-Type': 'application/json'}

def delete_client(subject, auth_token):
headers = {**HEADERS_BASE, **{"Authorization": auth_token}}
response = requests.delete(
urllib.parse.urljoin(BASE_URL, "{}/".format(subject)),
headers=headers
)
return response.json()

A successful result will be similar to this:

{
"success": true,
"result": {}
}