GALAglobal / TAPICC-API-implementation

TAPICC API implementation using node.js framework sails.js
Other
6 stars 1 forks source link

search parameters #35

Closed assembledStarDust closed 5 years ago

assembledStarDust commented 6 years ago

Running the thought exercise of discovering a job and the tasks, to downloading a payload, it seems the process might be.

discover jobs. GET /job discover tasks of job GET /job/{id}/task download payload (as asset) as detailed in task GET /asset/{parentid}/task/{id}/downloaddeliverable

In the discovery of objects, would there be benefit in allowing search parameters, to pull back only what is required.

An example search maybe return all /job with tasks of type "translation" with targetLanguage of "fr-FR".

Is this already detailed somewhere?

Alino commented 6 years ago

there is no support for that currently. I am not sure if it is needed functionality, leaving this open for group discussion.

Alino commented 6 years ago

Actually sails.js framework supports this search (even sort) functionality out of the box.

Maybe we should mention this in our swagger definition or other documentation, to make it part of the TAPICC standard.


for example this curl request

curl -X GET "http://localhost:1337/assets?sourceLanguage=en" -H "accept: application/json" -H "Authorization: Bearer 111"

should filter all Assets where sourceLanguage is equal to "en".


Trying to achieve your example

curl -X GET "http://localhost:1337/tasks?type=translation&targetLanguage=fr-FR&populate=jobId,assetId" -H "accept: application/json" -H "Authorization: Bearer 111"

this would return all Tasks where type is "translation" and targetLanguage is "fr-FR", it should also populate assetId, so that you can retrieve all jobIds, and then you can perform separate search on those jobIds.

After you know the list of Job IDs (let's say it's 3, 5, 7), you can make another request to retrieve them by IDs

curl -g 'http://localhost:1337/jobs/?where={%22id%22:[3,5,7]}' -H "accept: application/json" -H "Authorization: Bearer 111"
Alino commented 5 years ago

we will include information how to do this in prose deliverables.