Skip to content

Taskrunner

Automating tasks in Entryscape can be done via utilizing API of the underlying database, EntryStore API. Some tasks involve several updates to the Entrystore, therefore, a simplified API for carrying out such tasks exists, the Taskrunner API.

Making calls to this API places the task in a queue, after which the several steps to carry out the task will be performed at the server side. During this process, it is possible to check the task status. Authentication is required in order to create tasks, an authentication cookie can be obtained from the Entrystore API.

Tasks

Add a file to a distribution

This task allows you to add an individual file to a distribution. It will also update the connected API distribution if there is one. The API will continue to work during the processing time and if successful, it will contain the data of the new file.

Identify the resource URI of the distribution which you want to add the file to, and pass it as a query parameter along with the file and authentication. An example of such a call is:

curl --location 
--request POST 'https://demo.entryscape.com/taskrunner/v1/distribution/addFile?resourceURI=https://demo.entryscape.com/store/34/resource/5' \
--header 'Cookie: auth_token=X' \
--form 'file=@"/home/test.csv"'

If a successful call was made, use the provided jobId key for checking the task status. A prototype URI is also provided, which is where the file will reside if the job is successfully carried out.

Replace a file of a distribution

This task allows you to replace an individual file of a distribution. It will also update the connected API distribution if there is one. The API will continue to work during the processing time and if successful, it should contain the replacing file's data.

Identify the resource URI of the file which you want to replace and pass it as a query parameter along with the file and authentication. An example of such a call is:

curl --location 
--request POST 'https://demo.entryscape.com/taskrunner/v1/distribution/replaceFile?resourceURI=https://demo.entryscape.com/store/34/resource/5' \
--header 'Cookie: auth_token=X' \
--form 'file=@"/home/test.csv"'

If a successful call was made, use the provided jobId key for checking the task status.

Task status

After successfully activating a task via the Taskrunner API, it is possible to check the status of the task. This is done by utilizing the jobId key which is received when when activating the task. Pass this job id as a parameter, in the following example the jobId is 12:


curl --location --request GET 'https://demo.entryscape.com/taskrunner/v1/job/12'

At a minumum, the response object consists of the id of the job and its status. If the job has terminated, it will also contain info on the results of the job.