HTTP REST API v1¶
In order to use the A||GO HTTP API, you have to copy your private token from your profile [page](https://allgo.inria.fr/users/edit)
Post a job¶
-
POST
/api/v1/jobs
¶ Submit a new job
Form Parameters: - job[webapp_id] – int webapp identifier
- job[param] – a string used as parameter
- files[0] – a first file
- files[1] – a second file, etc …
Request Headers: - Authorization – Token token=<your_private_token>
- Content-Type – multipart/form-data
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "id":40155, "url":"https://allgo.inria.fr/api/v1/jobs/40155" }
Here is a example with curl
curl -H 'Authorization: Token token=<your_private_token>' -X POST -F job[webapp_id]=<service_id>
-F job[param]='' -F files[0]=@<path_to_file0> -F files[1]=@<path_to_file1>
https://allgo.inria.fr/api/v1/jobs
This request will return you, either the errors, or if it’s ok, your job_id
Get results¶
Third, check the resulting job to get the url files with :
-
GET
/api/v1/jobs/(int: job_id)
¶ Retrieve job informations
Request Headers: - Authorization – Token token=<your_private_token>
Example response:
{ "40155": {"conv1_samusa.txt":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1_samusa.txt", "conv1.json":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1.json", "conv1.mp3":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1.mp3", "allgo.log":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/allgo.log" }, "status":"done" }
Each file could be downloaded with the link associated.
GET /api/v1/jobs/40155 HTTP/1.1
Host: allgo.inria.fr
Accept: application/json
Authorization: Token token=<your_private_token>
curl -i https://allgo.inria.fr/api/v1/jobs/40155 -H 'Accept: application/json' -H 'Authorization: Token token=<your_private_token>'
wget -S -O- https://allgo.inria.fr/api/v1/jobs/40155 --header='Accept: application/json' --header='Authorization: Token token=<your_private_token>'
http https://allgo.inria.fr/api/v1/jobs/40155 Accept:application/json Authorization:'Token token=<your_private_token>'
requests.get('https://allgo.inria.fr/api/v1/jobs/40155', headers={
'Accept': 'application/json',
'Authorization': 'Token token=<your_private_token>',
})
HTTP/1.1 200 OK
Content-Type: application/json
{
"40155":
{"conv1_samusa.txt":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1_samusa.txt",
"conv1.json":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1.json",
"conv1.mp3":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/conv1.mp3",
"allgo.log":"https://allgo.inria.fr/datastore/6/1/0fe2bc68b835e9a1f681e38d5e87001ef955e345/allgo.log"
},
"status":"done"
}