GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55...

16
GET • Examples http://seek.sysmo-db.org/sops/3/ex perimental_conditions/55 – http://www.pathwaycommons.org/pc/ webservice.do? cmd=get_pathways&version=2.0&q=O14 763&input_id_type=UNIPROT

Transcript of GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55...

Page 1: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

GET

• Examples– http://seek.sysmo-db.org/sops/3/experimental

_conditions/55

– http://www.pathwaycommons.org/pc/webservice.do?cmd=get_pathways&version=2.0&q=O14763&input_id_type=UNIPROT

Page 2: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Configuring GET

• Signature

• Content Type / (Accepts header)– application/xml– application/json– text/csv

Page 3: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Signatures

• http://seek.sysmo-db.org/sops/{sop_id}/experimental_conditions/{exp_cond_id}

• http://www.pathwaycommons.org/pc/webservice.do?cmd=get_pathways&version={version}&q={q}&input_id_type={type}

Page 4: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Created Service

Get_Exp_Conditions_For_SOP

sop_id exp_cond_id

body status Redirection

Page 5: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Outputs

• Body– The http response from the service, according to the

content type• Status

– The HTTP status code• 200 – OK• 301,302,303 – redirects (more to come on this)• 401 – Unauthorised• 404 – Not found• 500 – Server Error

• Redirection– URI of last redirection

Page 6: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Handling outputs

• XML response– Handle with XPath

• Enhance xpath support• Embed within Rest processor??

– PRO: Avoids splitter problem– CON: Better xpath support may be useful regardless of

rest

• JSON– Handle with JSON path– Not sure if this is needed

Page 7: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Redirection

• Redirection may occur due to linked data compliance, or because the resource has moved.

• 301 – Moved permentantly• 302 – Found• 303 – See other (linked data)• 304,305,306,307 (see spec)• Body response is that of the final redirection ??• Status is of the final redirection ??

Page 8: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

PUT/POST

• PUT – Update a resource

• POST – Create a resource

• Can’t always rely on this being true

Page 9: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Configuring PUT

• Signature– http://seek.sysmo-db.org/sops/{sop_id}/experi

mental_conditions/{exp_cond_id}

– Content type• application/xml• application/json• text/csv

Page 10: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

2 ways of updating

• With parameters– http://seek.sysmo-db.org/sops/{sop_id}/

experimental_conditions/{exp_cond_id}?measured_item={item}&value={value}

• With request body<xml? …><exp_condition>

<measured_item>PH</measured_item><value>8.7</value>

</exp_condition>

Page 11: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Created Service

Update_Exp_Conditions_For_SOP

body sop_id exp_cond_id

body status redirection

Page 12: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Configuring POST

• Signature pretty much the same– http://seek.sysmo-db.org/sops/{sop_id}/

experimental_conditions/

• Once again content type– Application/xml– etc

Page 13: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Once again, 2 ways of creating

• With parameters– http://seek.sysmo-db.org/sops/{sop_id}/

experimental_conditions/?measured_item={item}&value={value}

• With request body<xml? …><exp_condition>

<measured_item>PH</measured_item><value>8.7</value>

</exp_condition>

Page 14: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Redirection of POST

• Redirection is most important for POST as it provides the identifier for the new resource.– E.g after creation may get redirected to

http://seek.sysmo-db.org/{sop_id}/experimental_conditions/{new_exp_condition_id}

• Can’t always rely on it – need to know the service – Sometime there is not redirection and just the content

type of the new resource is returned in the response body

Page 15: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

DELETE

• Deletes the resource based upon identifier

• Tends to redirect back to the list of resources of that type.

• Just needs the signature to configure

Page 16: GET Examples – db.org/sops/3/experimental_conditions/55 db.org/sops/3/experimental_conditions/55 –.

Questions to users

• What to call the body inputs/outputs– Body, response, request_body,response_body

• Should we make the body inputs/ouputs configurable for POST/PUT

• Should redirection stuff be hidden from the user, and optionally visible?

• Built in XPATH support, or separate?• Tools to help provide XML body inputs for

PUT/POST– Beanshells & templates.