API server

The GTC REST API has an automatically generated documentation site. Registering data requires user authentication. This document will provide more detail regarding how to encode the authentication information securely.

Quick Start

An open-source collection of scripts used to interface with the API is available. These utilize common unix command line software such as curl.

git clone https://github.com/glytoucan/databaseSync.git

./curlRegister.sh <GTC Contributor ID> <GTC API Key> <sequence data>

New Submissions page (Aug 2019)

If you login to the GlyTouCan Entries page, the data sent over command line can be confirmed.

Registering Structures

In order to store user-submitted data into the GlyTouCan RDF, an authorization check is required to authenticate the registrant. Instead of using a username and password, GlyTouCan generates a specific Contributor ID and API key. The ID and key can be obtained via the profile page.

Authentication Method

Basic Authentication over HTTPS is used to transfer the user authentication information. This is not clear from documentation (as it does not support basic authentication). If accessed directly over browser it will prompt for a username and password, if the user id and api key is supplied, the request will be processed. How basic authentication is handled depends upon the tool being used, for curl, it is the --user parameter. The following is a json example.

Example

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --user <GTC Contributor ID>:<GTC API Key> -d '{ "sequence": "<sequence data>" }' 'https://api.glytoucan.org/glycan/register'

Note how the GlyTouCan Contributor Id and API Key are passed in the basic authentication parameter. The sequence data should be supplied in JSON format with the “sequence” key.

Return Message

If all went well, the result will return a message in the following format:

{"timestamp":"2019-08-20T05:58:13.394+0000","status":"202","error":"","message":"532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25","path":"/glycan/register"}

The message field indicates a reference tag to the submission. This tag can be used to confirm the status of the submission on the Submissions page.

Samples

We’ve provided sample scripts to access the API.

Installation

git clone https://github.com/glytoucan/databaseSync.git

Register an entry

The above curl command is in the curlRegister.sh script.

aoki@bluegold:~/workspace/databaseSync$ ./curlRegisterTest.sh  <GTC Contributor ID> <GTC API Key> CLITest
{"timestamp":"2021-01-05T10:10:16.972+0000","status":"202 ACCEPTED","error":"","message":"bdb497c8f2b103451a6320f765853e2c6c6c5c6dc64aec7ca5b48c96b0658675","path":"/glycan/register"}

Please Note The scripts ending with Test.sh are hard-coded to access the test environment using the test domain name. To submit to the main site, use the scripts without “Test”.

Partner API

If you have registered as a partner, the API offers partner-specific functionality.

Important Note Regarding Contributor ID

It is highly recommended to create a “service account” email address in order to maintain the linkage data between glytoucan and your organization. This way it will be possible to share this account with other trusted maintainers of your database, without giving away any private passwords.

To create a service account, all that is necessary is to create an account such as “myDatabaseSupport@gmail.com”, confirm the email once registered, and then login to GlyTouCan with this account. Please be sure to confirm the email is verified as GlyTouCan does not accept submissions from users without a confirmed email address.

As GlyTouCan can handle multiple users to a database, the service account can be added later once you are ready. Please use the contributor id and api key for this account. This information is available on the profile screen once you have logged in.

Partner Page

First be sure to login to the GTC site with the email address registered as a partner.

Each entry page will recognize if you are a partner, and will offer a link to the partner page. Here is a direct link to the G46677TE Partner page.

Add Partner ID

Add a new partner id test0.

aoki@bluegold:~/workspace/databaseSync$ ./curlPartnerAdd.sh userID apiKEY G51902CJ test0
Edit Partner ID

Modify the test0 id to test1.

aoki@bluegold:~/workspace/databaseSync$ ./curlPartnerEdit.sh userID apiKEY G51902CJ test1 test0
Remove Partner ID

Delete the test1 id.

aoki@bluegold:~/workspace/databaseSync$ ./curlPartnerDelete.sh userID apiKEY G51902CJ test1

The following is a sample result return:

{"timestamp":"2020-07-02T05:47:11.996+0000","status":"202","error":"","message":"test0 for WURCS=2.0/3,3,2/[a1122h-1x_1-5][Aad21122h-2x_2-6_5*NCC/3=O][Aad21122h-2x_2-6_5*NCCO/3=O]/1-2-3/a?-b2_b?-c2 deletion submitted.  Please check https://glytoucan.org/Users/structure for status.","path":"/glycan/register"}

Note that it searches for the sequence and updates ResourceEntry class directly.

Technical Documentation

For more details on other requests, please refer to the generated documentation. Please contact us if there are any other structured queries that should be added, updated.