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!
There is a newer version of the HTTP App available for Switch – Version 16.0 — It has OAuth 2.0 as an option. This version of the HTTP App has an issue that will cause it to error. If you have this version, we recommend contacting Enfocus on how to downgrade your HTTP App to version 15.0. 

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/5a73c78-a682-4f5d-9o3c-cf956e175d96

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 it’s at does not matter, only where it’s going and that is defined under the “Parameters”.