Examples

Create the client object and login to a specific instance using your API token

You can find your API token on your profile page on the arkindex instance, for example https://demo.arkindex.org/user/profile/

from arkindex import ArkindexClient
cli = ArkindexClient('YOUR TOKEN HERE', base_url='https://demo.arkindex.org')

Listing all items of type page in a given project (corpus)

The corpus parameter is the project id, which can be found on the project information page, e.g. https://demo.arkindex.org/corpus/84be3b39-d559-40ce-a870-97aa3f3980ab

for element in cli.paginate('ListElements', corpus='84be3b39-d559-40ce-a870-97aa3f3980ab', type='page'):
    print (element['name'])
for folder in cli.paginate('ListElements', folder=True):
    print(folder['name'])

Download full logs for each Ponos task in a process

workflow = cli.request('RetrieveWorkflow', id='...')
for task in workflow['tasks']:
    with open(task['id'] + '.txt', 'w') as f:
        f.write(cli.request('RetrieveTaskLog', id=task['id']))