Using the HTTP App with Good2Go

Locking a file with the API

This tutorial uses the HTTP App from Switch, to access the Good2Go API to lock a file. This tutorial will exaplain how the App settings are used to access Good2Go APIs.  Principles described in this tutorial may apply to other API calls. 

Settings overview

  1. URL: This defines the API and what function will be used and to what?
  2. Request Type. This defined the type of HTTP call. In this case, we’re looking to modify an existing file so we will use the “POST” request. 
  3. Authentication scheme will be OAuth.
  4. Authorization must start with “BEARER” followed by a space and your Good2GO Account Token. 
  5. Parameters: The actual action to POST. In this case “Locked=1”.  The number 1 = ON or YES.
  6. Headers: This is standard for all calls: Accept:application/json

IMPORTANT NOTE on HTTP APP version!
For the HTTP App to work with an API directly, you may need to use version 15 or version 20 depending on your version of Switch. If you’re on a newer version of Switch 2022 or newer, use version 20. If you’re on an older version of Switch, use version 15. You will get errors with version 16.
Contact us if you have any questions. 

URL Setting Details

Above: URL, Single line text with variables dialog. Below, URL details to call API.

In plain English, this URL path says: “Using the “Jobs” api, locate this file and lock it.” 
The URL path starts by locating your Switch server and calling for the “Jobs” api (in red). The Jobs API is used because its where the “Locking” function is found. The metadata path (blue) is locating the file’s Unique ID — every file, or folder has an encrypted unique ID. This is extracted from the Good2Go dataset. In the final part of the path the API function is defined. 

Moving a file with the API

This tutorial uses the HTTP App from Switch, to access the Good2Go API to move a file into a folder within the Good2Go environment. This can be very useful to clear files out of input hot folders or to keep files organized based on the automation status or production phase.  

Settings overview

  1. URL: This defines the API and what function will be used and to what?
  2. Request Type. This defined the type of HTTP call. In this case, we’re looking to move an existing file so we will use the “PUT” request. 
  3. Authentication scheme will be OAuth.
  4. Authorization must start with “BEARER” followed by a space and your Good2GO Account Token.
  5. Parameters: The actual action to PUT. In this case we want to tell Good2Go where we want the file to go. In this case, it will be a specific folder, so we just need to define the folder by its unique ID.
    An Example is:
    parent_guid=87863c-3290-4146-908-d638dd7eb18
  6. Headers: This is standard for all calls: Accept:application/json

How to get the folder UID

This is actually pretty simple. Just open the folder in Good2Go and the UID for that folder will be in the browser URL. This is why you can bookmark folders, or most views in Good2Go if you need to access them regularly.
The folder UID is highlighted in Red below. 

www.review.good2gosoftware.com/review/jobs/depot/87863c-3290-4146-908-d638dd7eb18

URL Setting Details

Above: URL, Single line text with variables dialog. Below, URL details to call API.

In plain English, this URL path says: “Using the “Jobs” api, and locate this file.” 
In this URL path, we simply use the “JOBS” API to get the files unique ID (GUID). This can be done by building a location path from a files Good2Go Dataset. We only need to know which file is going to be moved at this point. Where is at in Good2Go does not matter. It only where the file or folder is going. The new location is defined under the “Parameters” setting.