Proposal API Guide


This guide explains how to read proposal metadata from the HZDR proposal management system GATE with our HELIPORT REST API.

Create and copy HELIPORT API key with the HELIPORT webinterface.

The Heliport REST API requires an authentication token which can be generated via our REST API.

  1. On a terminal type curl -X POST https://vlsdms.fz-rossendorf.de/token/ -d "username=HZDR_USER&password=HZDR_PASSWORD" and replace HZDR_USER and HZDR_PASSWORD with your HZDR credentials.

    The response should look like this:

    {"token":"9ff3ddjuiikl3l2mnn56pghsw6mwqh"}
    

    Copy the authentication token and store it in a save location.

  2. You can see your token also when log into HELIPORT and navigate to your account settings:

  3. Under settings you can see the same authentication token.

  4. Access the API with curl -H "Authorization: Token YOUR_TOKEN" https://vlsdms.fz-rossendorf.de/api/ and replace YOUR_TOKEN with the authentication token from your HELIPORT account settings. The result is a list with our top-level API commands:

      {
         "projects":"https://vlsdms.fz-rossendorf.de/api/projects/",
         "users":"https://vlsdms.fz-rossendorf.de/api/users/",
         "groups":"https://vlsdms.fz-rossendorf.de/api/groups/"
      }

Further API endpoints can be found in our HELIPORT REST API documentation.

  1. Read gate projects with: curl -H "Authorization: Token YOUR_TOKEN" https://vlsdms.fz-rossendorf.de/gate_connection/api/gate_project/

Use a programming language of your choice (we use python for this example):

In this Python example we store the token in a secret .env file and load it with the python package dotenv.

      import os
      from dotenv import load_dotenv

      load_dotenv()
      access_token = os.getenv('HELIPORT_TOKEN')

      api_url = 'https://vlsdms.fz-rossendorf.de/'

Project information:

      import pprint
      import requests
      from requests.exceptions import MissingSchema

      headers = {
         'accept': '*/*',
         'Content-Type': 'application/json',
         'Authorization': 'Token ' + access_token,
      }

      option = 'api/projects/'

      response = requests.get(
         url = api_url + option,
         headers=headers,
      )
      data = response.json()

      while True:
         for x in data['results']:
            if 'Publication' in x['label']:
                  pprint.pprint(x)

         try:
            response = requests.get(
                  url = data['next'],
                  headers=headers,
            )
            data = response.json()
         except MissingSchema:
            break

(GATE) Proposal information

At the moment we only show proposals that are assigned to the user (Token)

      option = 'gate_connection/api/gate_project/'

      response = requests.get(
         url = api_url + option,
         headers = headers,
      )
      if response.status_code == 200:
         data = response.json()
      else:
         print(response.status_code)
      pprint.pprint(data)

Heliport workflows can be found in our GitLab project.

Back