How to add a new API resource with operations

From ToxBank API Wiki
Jump to: navigation, search

Adding a new API Resource to the ToxBank extension of the OpenTox API is as simple as creating a new wiki page, and adding this wiki source content:


This REST_resource template ensure the proper RDF triples get created.

Following that content, you can add a description of what the meaning is of this resource.


REST operations on this resource can be added too. Right now, the custom is to add a section, followed by a brief description and/or example how to use it with curl.

The operation itself uses a separate page (or a wiki sub page), so that the the minimal operation wiki source in the resource page will look like:

== Retrieve Metadata of a single Protocol ==
{{HasOperation |id=Protocol:RetrieveMetadata}}

This particular example has a colon ':' in the wiki page name, indicating a sub page, but any wiki page will do.

The Operation page content

The operation wiki page itself should use a template too, like the resource, but now it should use the REST Operations template, so that the page content should like something like:

{{REST Operations
|REST_op_description=Retrieves the protocol metadata
|REST_op_params=TBD, search options to filter the requested metadata fields
|REST_op_result=The metadata representation in supported media type
Personal tools