REST Web Services

Available services

All the following methods provide results in XML and JSON and are available via a GET query.

In order to be able to resolve obsolete versions of URIs (which used URLs), you need to use a POST query. This is due to the fact that the fragment identifier (the part of the URL which starts by a '#' character) is not passed to the server.

The schema of the XML response is the same as the one used for the XML export of MIRIAM Resources, and is available at:

Command line tools

A simplest way to query these REST services is to use a command line tool, like Wget or cURL.

For example, using Wget, you can query any of the available services and specify which kind of format you would like to retrieve.

To get an XML response:

        wget --header="Accept:text/xml"

To get an JSON response:

        wget --header="Accept:application/json"

Programming language

If you are using Java, you could use Jersey in order to query the services:

        import com.sun.jersey.api.client.Client;
        import com.sun.jersey.api.client.ClientResponse;
        import com.sun.jersey.api.client.WebResource;
        import com.sun.jersey.api.client.config.ClientConfig;
        import com.sun.jersey.api.client.config.DefaultClientConfig;
        import com.sun.jersey.api.representation.Form;

        public class MiriamRestClient
            public static void main(String[] args)
                // initialisation
                ClientConfig config = new DefaultClientConfig();
                Client client = Client.create(config);
                WebResource service = client.resource(UriBuilder.fromUri("").build());

                // GET queries
                System.out.println("GET (XML):\n" + service.path("datatypes").accept(MediaType.APPLICATION_XML).get(String.class));
                System.out.println("GET (JSON):\n" + service.path("datatypes").accept(MediaType.APPLICATION_JSON).get(String.class));

                // POST queries
                Form form = new Form();
                form.add("uri", "urn:miriam:obo.go:GO%3A0045202");
                ClientResponse response = service.path("resolve").accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, form);
                System.out.println("POST (JSON): " + response.getEntity(String.class));