Lightweight Data Source Integration for websites

To reduce the development required to integrate websites with GenomeSpace, we have created a lightweight data source integration method suitable for use by websites and web applications.

Web Site Requirements

To use this method, websites must be able to support the following:

  • add an iFrame to a page
  • provide a unsecured URL to any file to be sent to GenomeSpace

How It Works

The GenomeSpace server provides a page fragment (https://gsui.genomespace.org/jsui/upload/loadUrlToGenomespace.html) that has the minimum functionality needed to send data to GenomeSpace via a URL that the GenomeSpace server uploads.  When an application includes this fragment, it handles the basic communication with the servers to:

  1. Login or recognize a previously logged in user.
  2. Select a directory or subdirectory in the GenomeSpace user's home directory.
  3. Set and change the file name.
  4. Tell the GenomeSpace server to upload the file to the designated directory and name.

From the point of view of the website, it simply needs to open this URl in a new window (see below)  and set the default file name and URL as parameters.  Optionally, it can also provide a Javascript method to call back when the file submission is successful.

 

An example HTML page using this mechanism can be found on the GSUI server at https://gsui.genomespace.org/jsui/uploaddialog.html

Example of Use

 

The following HTML is for the example page that will open the page fragment in a new dialog.

And the function in the included library just looks like this;  You can include the library or recreate this in your code

Note the two parameters being passed in: "uploadUrl" and "fileName".  UploadUrl is required and this is the URL GenomeSpace will try to do an HTTP GET on.  As a result this must not be protected by any authorization scheme or the GET will fail.  If you need to be able to upload files with full control over security, we suggest that you use the REST API directly and/or the CDK.

The fileName parameter is optional and will provide the default file name in the page fragment.  if no fileName parameter is provided, the dialog will use the end of the URL (everything after the last slash) as the default filename.

Why in a new window?

In this example we use a new window (as opposed to a JQuery load() call for example) because of the need for the upload page to be able to do page redirects if the user is not already logged into GenomeSpace. In this case, the uploader redirects the page to the main GenomeSpace OpenID login page, processes the login, and then redirects back.  In a seperate window, this is restricted to the new window; however, if this as done in the main application page body, the entire page would be redirected for the GenomeSpace login which would generally be undesirable.