API Integration

Learn how to leverage the features in Automate's powerful API integration kit.

Video Tutorial

Because data files are not designed to be read by humans, they can be difficult to work with in automation for all but the most seasoned developers.

JSON is the most popular data interchange format, and Automate’s JSON action renders data that’s easy to view and manipulate. Automate’s JSON action lets you view data in an easy-to-read format, as well as extract and edit values across your entire file.

In this tutorial, you’ll learn how to use the JSON action in Automate to:

  • Create a JSON object
  • Set values, get values, add new fields and more
  • Create a loop action to perform functions across  your file

Watch this video now to learn more about the JSON action.

 

Before you can start building Custom Actions, Automate users must first complete a few prerequisites. 

Watch this video to learn more:  

  • How to enable the Custom Actions setting 

  • How to download and install Microsoft Visual Studio 

 

 

Once the prerequisites are complete, learn how to use Automte’s Custom Actions feature to create your own native actions and activities for virtually any application, platform, or service with an SDK. 

In this tutorial, you’ll learn: 

  • How to enable the Automate Custom Actions SDK 

  • How to create a new Custom Action project 

  • An overview of the needed files to complete building your Custom Action 

  • How to create new actions and develop the code to perform the Custom Action 

  • How to set up your Custom Action’s GUI 

  • How to test your Custom Action 

  • How to enable and use your Custom Action 

Watch this video now to learn how to get started with Custom Actions. 

 

 

 

Experiential Learning

Download Training Materials

Overview:

This exercise sets up an API Integration session using Automate's API Integration framework. While Automate supports multiple authorization protocols, in this example we will be using OAuth.

Before you can access APIs using OAuth, you will need to register the application with the Provider, in this case Google. The process for registering an application is somewhat different from provider to provider, and as such, is not covered in this document. However, here are some helpful links to Google documentation describing the process.

Register app at: https://console.developers.google.com/

Recommended reading: Using OAuth 2.0 to Access Google APIs  |  Google Identity  |  Google Developers

Note: you will need to have a Google account to create an app.

As part of the registration process, you will need to provide "Authorized redirect URIs" for Google to communicate with Automate. For Automate OAuth, use http://localhost:8080

Note: The port (i.e., 8080) must be open to receive http messages from Google. 8080 is the default port chosen by Automate. You can choose to change this port.

When registration is complete, copy the Client ID and Client Secret as you will need these to setup the OAuth connection. Note that the Client ID and Secret are your application’s unique username and password used to communicate with Google.

Create the HTTP Session:

To create the session, you will need to provide the Authorization URL, the Access Token URL, the Client ID, the Client Secret, and the Authorization Scope. These Authorization and Token URLs are provided by the provider, in this case Google. For Client ID and Secret, use the unique values created for your app.

Make sure the callback port number matches the port number used when creating the app (e.g., 8080).

The Scope represents the information the app is requesting permissions to access. These values are specified by the provider as well.

Next, let's setup the HTTP Session:

  • Create a new Task and give it a name (e.g., HTTP OAuth2)
  • Add an HTTP Define Activity to create an HTTP Session.
  • For the Authentication type, choose OAuth2.0
  • You will need to enter the Authorization URL and Access Token URL specified by Google.
  • You will need to enter the Client ID and the Client Secret for the App that you registered with Google.
  • For the Authorization Scope, provide the scope of this App, that is, what APIs this application intends to access. (For example, “https://www.googleapis.com/auth/userinfo.profile” to access the user’s profile.)
  • If you are not using the default Port for the callback Port (i.e., 8080), make sure to update the port.
  • Save the Task.

Now you are ready to run the Task. When you first run the Task you will be prompted to log into your Google account and grant permissions to the App. Once you have granted access to the App, you will not be asked to grant access to the App in subsequent invocations of the Task, unless Google has expired your access. This may happen from time to time as a security measure.

Now you can access the Google APIs. Note: Based on the permissions requested for the App, the App will only be allowed to access those APIs. In this case however, the App will be limited in the APIs you can access. In order to access the full list of APIs, you will need to validate the App with Google.

Download Training Materials

Overview:

This example introduces you to the Automate JSON Action. JSON is an information interchange format that is heavily used with APIs. JSON is not intended to be consumed by humans, but Automate processes the content and presents the information in a human consumable form.

After completing this exercise you will have learned to:

  • Create a JSON Object
  • Get and set values in the JSON file
  • Add new items and delete existing items
  • Loop through a JSON array of items

General Instructions:

  • Create a new Task in Automate, for example, “My JSON Exercise”
  • Create an Automate Variable and give it a name, i.e. JsonString. For Initial values: copy the content from JSON_Exercise.txt.
  • Open a new “Create” Activity from the JSON Object action. For JSON Object name provide a name for the object, i.e. JsonObject.
    • For JSON string, provide the name of the Automate Variable containing the JSON string (i.e. JsonString). The Variable needs to be provided as an expression, that is %JsonString%. Instead of having to type in the expression, you can click on the expression builder in the JSON string text box (i.e. the % sign), highlight the Local Variables folder and double click on the Automate Variable. This will build the expression for you.
  • If you run these two steps in the task you will be ale to inspect the values in the Variables. To inspect the values click on the “Variables” panel on the bottom pane. This will list the variables. If you click on the left most column it will display an arrow icon. Click on the arrow icon and it will open up the inspection window.
    • Take note of how the two values are displayed. The JSON object displays in a human friendly tree format that makes it easy to work with.
  • Get the email of the first item in the data list, that is, email for James Smith.
  • Set the contact email for the second item in the data list, that is, Brandon Lowe. You will be changing Brandon’s email from Yahoo to Gmail.
    • As the Set value is very similar to the Get value, we'll leave it as an exercise. However, some hints are provided below
      • Create a variable with Brandon’s new email, that is, NewEmail variable with a value of [email protected]
      • Use the Set values Activity from the JSON Object Action
      • For JSON Object name, pick the JSON Object from the dropdown list
      • For Set field values, use the Set values button to open the JSON navigation tree
      • Navigate to Brandon’s Contact Email, and in the values field use the expression builder (i.e., the % sigh) to pick the variable with the new email address. (Note, you will need to double-click on the variable.) This will build the expression for you.
      • Close the JSON navigation tree. This will populate the Set field values table.
        • Note: you can set multiple values at the same time.
      • Close the Activity.
      • Run the Activity and inspect Brandon’s email in the JSON file. The email should have been updated.
  • Add a Country field to second element of the Data list, that is to Brandon’s address. We leave these as exercises for the user. We'll provide some hints below:
    • Use the Add field Activity from the JSON object Action.
    • Once again use the JSON Object navigator to pick the object to which you want to add the field, in this case it would be Data[1]. (Note: the items in list start at 0 so the second element is 1.)
    • For Filed name type Country, and for Field type, pick Text.
    • For Field value, type USA.
    • Close the Activity.
    • Run the task and inspect the JSON Object. A new Country filed should appear in the JSON Object in Bandon’s email.
  • Delete from the JSON file. We leave these as exercises for the user. We provide some hints below:
    • To delete a field, for example, James Smith’s Contact Email use the Delete field Activity.
    • To delete an entire element, e.g., all information related to James Smith, use the Delete from Activity from the JSON Object action.
  • Looping though the Data list and collect all first names.
    • This is an advanced use case that involves many Activities unrelated to the JSON Action. The interested user may peek at the referenced example for hints.