API settings

Version 1.0
Endpoint /-api/settings/v1

Settings management

Export Settings

Endpoint /-api/settings/v1/export?owner=...&project=...
Method GET
Output JSON

Input Parameters

None

Coding examples

curl -u yourUsername:yourPassword 'https://www.tagtog.net/-api/settings/v1/export?owner=yourUsername&project=yourProjectName'

Import Settings

Endpoint /-api/settings/v1/import?owner=...&project=...
Method POST
Output JSON; fields: 1) mapNewIds and 2) newSettings (the new imported project's JSON settings)

Input Parameters

JSON project settings, in the same format as returned by exporting the settings.

Coding examples

curl -u yourUsername:yourPassword -H "Content-Type: application/json" -XPOST 'https://www.tagtog.net/-api/settings/v1/import?owner=yourUsername&project=yourProjectName' -d @$HOME/Downloads/tagtog_yourUsername_yourProjectName.json


Annotations Legend

GET a JSON map of annotation tasks ids to names (e.g. {"e_1": "Person"}).

Endpoint /-api/settings/v1/annotationsLegend?owner=...&project=...
Method GET
Output JSON

Input Parameters

None

Coding examples

curl -u yourUsername:yourPassword 'https://www.tagtog.net/-api/settings/v1/annotationsLegend?owner=yourUsername&project=yourProjectName'


Folders management

Add folder

Endpoint /-api/settings/v1/folders/add?owner=...&project=...
Method POST
Output JSON; fields: 1) mapNewIds (always empty), and newSettings (the new project's JSON settings)

Input Parameters

Two variants in JSON format:

  1. (Full) path:
Name Default Example Description
path - pool/new Full path of the new folder
  1. Parent path & new folder name (example):
Name Default Example Description
parentPath - pool Full path up to the parent (included) of the new folder
newFolderName - new New folder name to be added to the parent path

In both cases, the parent path must have been already defined. In other words, in Unix jargon, mkdir is permitted, but not mkdir -p.

Coding examples

curl -u yourUsername:yourPassword -H "Content-Type: application/json" -XPOST 'https://www.tagtog.net/-api/settings/v1/folders/add?owner=yourUsername&project=yourProjectName' -d '{"path": "pool/new"}'
import requests

tagtogAPIUrl = "https://www.tagtog.net/-api/settings/v1/folders/add"

auth = requests.auth.HTTPBasicAuth(username='yourUsername', password='yourPassword')
params = {'project':'yourProjectName', 'owner': 'yourUsername'}
payload = {'parentPath': 'pool', 'newFolderName': 'myNewFolder'}
response = requests.post(tagtogAPIUrl, auth=auth, params=params, json=payload)
print(response.text)

Rename folder

Endpoint /-api/settings/v1/folders/rename?owner=...&project=...
Method POST
Output JSON; fields: 1) mapNewIds (always empty), and newSettings (the new project's JSON settings)

Input Parameters

Name Default Example Description
path - pool/new Full path of the existing folder to be renamed
newFolderName - newRenamed New folder name

The given path must exist. The last element of the path (in the example: “new”) is renamed to “newRenamed”

Coding examples

curl -u yourUsername:yourPassword -H "Content-Type: application/json" -XPOST 'https://www.tagtog.net/-api/settings/v1/folders/rename?owner=yourUsername&project=yourProjectName' -d '{"path": "pool/new", "newFolderName": "newRenamed" }'

Remove folder

Endpoint /-api/settings/v1/folders/remove?owner=...&project=...
Method POST
Output JSON; fields: 1) mapNewIds (always empty), and newSettings (the new project's JSON settings)

Input Parameters

Name Default Example Description
path - pool/newRenamed Full path of the folder to be deleted

The given path must exist. You can “delete multiple levels” at the same time. That is, if the folder path (in the example) pool/newRenamed/otherLevel existed, while deleting newRenamed, the folder otherLevel would also be deleted.

⚠️ CAUTION: all documents within the (possibly-multiple) deleted folders are also deleted! Make sure you do not delete valuable documents. At the moment there is no API to “move” documents between folders. However, the same can be implemented by 1) downloading, 2) removing, 3) reuploading to a different folder.

Coding examples

curl -u yourUsername:yourPassword -H "Content-Type: application/json" -XPOST 'https://www.tagtog.net/-api/settings/v1/folders/remove?owner=yourUsername&project=yourProjectName' -d '{"path": "pool/newRenamed" }'