[OTDev] [OTP] Broken API XML schemas on the new opentox site

Vedrin Jeliazkov vedrin at acad.bg
Wed Sep 2 13:43:52 CEST 2009


Hi Pantelis, All,

Let me answer your questions on behalf of Nina...

chung <chvng at mail.ntua.gr> wrote:

> Dear Nina,
> Could you give an example of how can one use curl to create a new
> feature definition, dataset and reference.

Sure, here it goes:

1) Create a new feature definition:

curl -i -X POST -H "name: test name 02" -H "reference_id: 1" -H "type:test
type 02" http://ambit.uni-plovdiv.bg:8080/ambit2/feature_definition

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Date: Wed, 02 Sep 2009 10:48:38 GMT
Location: http://ambit.uni-plovdiv.bg:8080/ambit2/feature_definition/12450
Accept-Ranges: bytes
Server: Noelios-Restlet-Engine/1.1.5
Content-Length: 0

2a) Create a new dataset (the example SDF file that I'm using can be fethed
from http://www.ligand.info/ligand_info_subset_1.sdf.zip and contains 2344
entries; please note that there's a limit on the size of uploaded files --
currently ~10 MB):

curl -i -L --user opentox:opentox --data-binary @ligand_info_subset_1.sdf -H
"Content-Type: chemical/x-mdl-sdfile"
http://ambit.uni-plovdiv.bg:8080/ambit2/dataset

HTTP/1.1 100 Continue

HTTP/1.1 303 See Other
Server: Apache-Coyote/1.1
Date: Wed, 02 Sep 2009 10:53:05 GMT
Location:
http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429
Accept-Ranges: bytes
Server: Noelios-Restlet-Engine/1.1.5
Content-Length: 0

HTTP/1.1 202 Accepted
Server: Apache-Coyote/1.1
Content-Language: en
Date: Wed, 02 Sep 2009 10:53:05 GMT
Location:
http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Refresh: 1;
url=http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429
Server: Noelios-Restlet-Engine/1.1.5
Content-Type: text/html;charset=UTF-8
Content-Length: 3190

2b) Check the status of an asynchronous task (see the Location header value in
the previous message) -- dataset import processing (proposal). 

curl -i
http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429

HTTP/1.1 202 Accepted
Server: Apache-Coyote/1.1
Content-Language: en
Date: Wed, 02 Sep 2009 10:55:13 GMT
Location:
http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Refresh: 1;
url=http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429
Server: Noelios-Restlet-Engine/1.1.5
Content-Type: text/html;charset=UTF-8
Content-Length: 3190

2c) Retrieve dataset location after asynchronous task completion (proposal):

curl -i
http://ambit.uni-plovdiv.bg:8080/ambit2/task/7f5ec0d1-d848-4d66-abd7-9cd7ee050429

HTTP/1.1 303 See Other
Server: Apache-Coyote/1.1
Date: Wed, 02 Sep 2009 10:57:50 GMT
Location: http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/28
Accept-Ranges: bytes
Server: Noelios-Restlet-Engine/1.1.5
Content-Length: 0

(again, please note the Location header value)

3) Create a new reference:

curl -i -X POST -H "name: test name 02" -H "algorithm_id: test algoritm_id 02"
-H "parameters: test parameters 02" -H "experimental_protocol: test
experimental_protocol 02" http://ambit.uni-plovdiv.bg:8080/ambit2/reference

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Date: Wed, 02 Sep 2009 11:01:32 GMT
Location: http://ambit.uni-plovdiv.bg:8080/ambit2/reference/11874
Accept-Ranges: bytes
Server: Noelios-Restlet-Engine/1.1.5
Content-Length: 0

I would also like to use this opportunity to make the following observations:

- it would be nice if developers could systematically provide example curl
queries for every set of resource, method, request, mime type, header option,
etc; should this be mandatory?

- the API specification in some cases lacks important details (e.g. on mime
types or header options); should these details become required attributes of
the API specification?

Kind regards,
Vedrin





More information about the Development mailing list