Lightweight Data Source Integration for websitesTo 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 RequirementsTo use this method, websites must be able to support the following:
How It WorksThe 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:
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. |