Instructions on how to use myExperiment API (With OAuth)

To allow client applications to request information from the API that is not public myExperiment uses OAuth.

In this folder there are tools to help set up your own client applications that makes calls to the myExperiment API:

Config Generator
This allows you to create a configuration so that you can use the myExperiment API with OAuth. See Creating a OAuth Config.
Manage Server List
This provides a way of updating the list of servers that you can select to generate a config for. See Managing the Server List
HTTP Request Client
This provide an HTML form interface to make OAuth myExperiment API calls. See Using the HTTP Request Client.
Client Application Template
By default this allows you to set the values in the pages GET header to determine the call made to myExperimeny API using OAuth. See Using the Client Application Template.

Setting up OAuth

  1. First you need to go and register this client with the server that you wish to use it with, unless you have already been provided with a consumer key and consumer secret by a myExperiment Admin. To do this you will need to go to <SERVER_URL>/oauth/ and click on the "Register Client Application" button. If you are not logged into the server you will be prompted t do this.
  2. In the "Register Client Application" page you will be propmpted to fill in the following fields:
    Name:
    This can be anything you want
    Main Application Url:
    This needs to be the URL your instance of myExperiment API Client (With OAuth)
    Callback Url:
    This is again the URL of your instance of myExperiment API Client (With OAuth)
    Support Url:
    This is not required but is usually a link to tell people how to use you app.

    You will also be prompted to select the permissions you want this key to have. This is currently not be implemented (as of 7/8/2008) and therefore all privileges are currently granted, so there is no need to select anything at all.
  3. Click to register your client application and you will be brought to a page that give you the details of the client application. The most important details on this page are your consumer key and consumer secret, which you will need to input into your Config Generator.
  4. After inputting your consumer key and consumer secret and making sure you have the right server set, click the "Get Access Token" button.
  5. This will redirect you to page on the server you are using your client with asking you to authorize this access. (If you are not logged into this server will have to log in before you are taken to this page). Check the "authorize access" checkbox and click the "Save Changes" button.
  6. This should return you to your Config Generator with a value set for the "Access Token" and "Base64 Encoded Configuration" fields. Follow the instructions on the page and copy your Base64 Encoded Configuration to "inc/Config.php".
  7. You can now user either the HTTP Request Client or Client Application Template to make requests to the myExperiment API using OAuth.

Managing the Server List

Manage Server List can be used to add or remove servers for which the Config Generator can generate configs. By default the server list contains:

If you have your own server Manage Server List allows you to add it. Unwanted servers can also be easily removed. To make sure that Manage Server List works correctly make sure that myexp_urls.txt's file permissions allows the webserver to read and write to it.

Making Requests

Assuming you have setup a config using the instuctions in Creating a OAuth Config, when you go to HTTP Request Client, the "Connected to Server" field should say that you are connected to the server where you registered your client application and authorized an access token. If this is not case try clicking "Reset Config" or creating a new config using the Config Generator.

Making requests is made easier with a guided interface. All you need to do is select your method, resource and parameters and hit either "View In Page" or "View Raw XML". The former will return you the XML is a box above the original request interface, the latter will display a page with just the raw XML. If you are using the POST/PUT methods you can use the "Body" text area to fill in your data.

Using the Client Application Template

The Client Application as it names suggests is a stripped down version of the HTTP Request Client that allows you to edit it to build your own client application. It is well-commented so it should be easy to see what is going on. By default the client allows you to put the parameters in the GET header. If you type in the following URL you should get a page with the output of the request, assuming you have setup a config:

        http://yourserver/yourdirectorypath/oauth4myexp/template?method=GET&command=workflow.xml&id=6&all_elements=yes

Problems

If you have any problems using these applications feel free to contact the myExperiment developers mailing list with a detailed description of the problem you have encountered.