All instructions related to Swagger require you to first authenticate yourself whenever you’ve opened a window with the Swagger UI. Below are detailed instructions on how to make sure you are fully authenticated when using Swagger API functions.
Opening new tabs, running into errors/failures, refreshing your page, or letting enough time go by can all cause your authentication to expire. If you're getting errors (especially 401 errors or any kind of "unauthorized" errors), the first thing to do is to try to re-authenticate using the instructions below.
1. Authenticate your credentials on Swagger
Go to the Swagger UI page for the service that you want to access via API. Note that there are separate Swagger pages for things like notebooks or the Terra Data Repository. The API endpoints for the Terra Data Repository (where you'll find the commands necessary for ingesting data) can be found at https://data.terra.bio/swagger-ui.html. For notebooks, API commands for doing things like creating or deleting virtual machines or persistent disks can be found at notebooks.firecloud.org.
Go to the Swagger page of interest and begin by completing your authorization. If you're already using Swagger, and you notice you're starting to get a lot of errors and failures, try refreshing the page, and continue following these instructions: Click "Authorize"
check off all of the boxes at the bottom of the pop-up and click "Authorize" again, and then select the email that is associated with the billing project that you'll be using to create the cloud environment
After you've clicked "Authorize" and selected your login credentials (you may be asked for a password), you'll see the pop up below. Make sure to click "close" and not "log off" to stay authenticated as you execute the API functions.
2. Execute API functions
You can now use the API functions listed on the page, assuming the email you authenticated with has access to Terra resources. You do this by selecting the function of interest to de-collapse the details, click "Try it out" in order to activate the fields, fill in the fields, then click "Execute."