An Example Client
Disclaimer
The client used throughout these pages serves as an example.
The Python programming language has been chosen both for the its clarity and ubiquity.
There are intentionally no library dependencies.
If you are working with ${LANGUAGE}
and need a client, you can use this example as a reference while consulting the
complete JSON schemas.
Getting Started
Prerequisites
- You have a working installation of Python 3.
- You are familiar with the variables
ARDOQ_API_HOST
,ARDOQ_API_TOKEN
andARDOQ_ORL_LABEL
described in the previous section.
Setup
- Create a new directory called
ardoq_api_examples
. It doesn't matter where where the directory is located. - Download the Example Ardoq Client and place it in the directory. It should have the name
example_ardoq_client.py
. - Create a new file called
example.py
and place it in the directory.
Testing the Client
In order to test the client and your credentials we can query the /api/v2/me
endpoint. Modify the newly created example.py
file to contain the following:
import example_ardoq_client
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--host", metavar="ARDOQ_API_HOST", type=str, help="host name")
parser.add_argument("--org", metavar="ARDOQ_ORG_LABEL", type=str, help="org label")
parser.add_argument("--token", metavar="ARDOQ_API_TOKEN", type=str, help="API Token")
if __name__ == "__main__":
args = parser.parse_args()
api = example_ardoq_client.API(
ardoq_api_host=args.host, ardoq_org_label=args.org, ardoq_api_token=args.token
)
print(api.me())
Assuming that you have an API token 12345
that grants you access to myorg
hosted on a custom domain myorg.ardoq.com
:
Should display something similar.
If you are not using a custom domain (ie your Ardoq instance is hosted on app.ardoq.com
) then you could use the following
Help
If you get an unexpected result please make sure that you have read the section about making a request.