Going to production
This guide will show you the steps you need to take in order to successfully run the annotation tool in production.
Access tokens
Before initializing the annotation tool in production you need a valid access token. Access tokens is created by sending a POST request to the Pathfindr API.
curl --location --request POST 'https://api.pathfindr.dev/api/tokens' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <API key>' \
--form 'type="annotation"' \
--form 'entity_id="name_of_your_customer"' \ #optional
--form 'category_id="department_or_group_or_class"' \ #optional
--form 'external_user_id="The_ID_you_want_to_use_to_identify_your_user"' #optional
The reponse from the API will contain the access token and the expiration time.
{
"access_token": "<ACCESS TOKEN>",
"expires_at": "2022-08-17T18:17:14.844030Z",
"media_file_id": "<MEDIA FILE UUID>",
"document_file_id": "<DOC FILE UUID>"
}
After recieving the access token you can send it to your frontend and use it to initialize the annotation tool. When the access token have been used once it will be invalidated and can not be used again. You will need to create a new one for each new initialization of the annotation tool.
API key
Get API keyIn order to authorize yourself when sending requests to the API you need a API key. Send us an email hi@pathfindr.dev in order to get your API key today!
The API key is secret and should never be shared with anyone. All requests using the API key should be sent from your backend and never your frontend.
Metadata
This feauture is next on our roadmap and will be available soon.
For your convenience we added optional metadata variables that you can store with the file in our system. You can use the metadata variables to query your files to get metadata and CRUD your files easier.
# remember to add a \ at the end of the previous line
--form 'entity_id="name_of_your_customer"' \
--form 'category_id="department_or_group_or_class"' \
--form 'external_user_id="The_ID_you_want_to_use_to_identify_your_user"'