Connect to an API and use a GET to retrieve JSON Rest data

One of the simplest mechanisms for getting data is a GET call to a JSON Rest API end point. In Boomi, use the HTTP Client connector to exchange data with HTTP-enabled servers using the Hyper Text Transfer Protocol (HTTP) and Hyper Text Transfer Protocol Secure (HTTPS) protocols. A good place to start building your understanding of this connector is the HTTP Client connector documentation.

This article is intended for individuals who have a Boomi Associate Integration Developer Certification. If you do not know how to complete an action like “add a message shape”, please complete the recommended trainings

In this example we will access a publicly available API and retrieve a quote. There is no security involved in this endpoint but usually you will encounter more steps to configure a connection to an endpoint.

 Instructions

We will be creating the process shown here

  1. Set your start shape to be a Connector and select the HTTP Client

  2. Put httsp://zenquotes.io/api/random in the URL and set the Authentication Type to None in the Connector definition

  3. Set the Action to Get and leave your operation as a GET. Set the Content Type to application/json

  4. Add a stop shape to the Start shape and then click Test

  5. Select an appropriate atom to run the test. When the green halo appears around the stop shape, the process has executed successfully. Click on the stop shape and in the Test Results panel at the bottom, navigate to Shape Source Data and click the Source document that was sent from zen quotes

  6. In the document viewer, click the Dowload Original Document link so you have a sample json document to build a profile definition. Boomi will download a .dat file to your local machine.

  7. Navigate back to the build pallet by clicking the arrow to the left of the process name on the test view.

  8. In your working directory, create a New Component by clicking the ellipses on the directory

  9. Select JSON Profile

  10. Click Import Profile.

  11. Select the file downloaded in step 6 and click Next.

  12. On the Import Wizard Success window, click Finish

  13. You will have a new JSON profile like the one shown here. Rename it from New JSON Profile to something representative of the data like ZenQuotes JSON Profile. Click Save and Close.

  14. In your working directory, create a New Component by clicking the ellipses on the directory. This time select Flat File Profile

  15. Rename the flat file profile from New Flat File Profile to something representative of the Data and add two elements to the record, quote and author.

  16. On the options tab, you can change the delimiter, qualifiers, etc. When this looks how you want, click Save and Close.

  17. Add a Map Shape to the start shape and click the green plus to create a new map

  18. Update the name of the map and drag the q object of the json to the quote element of the flat file. Drag the a element of the json to the author element of the flat file. Click Save and Close.

  19. Add a message shape and enter the message {1} said “2” and then set variable 1 and 2 to the author and quote flat file elements.

  20. Add a stop shape.

 

Time to test

How to Test

  1. Click Test in the upper right corner of the process pallet.

  2. Pick the Test Atom Cloud (TAC) available in your subaccount and click OK. An example shown here is the UConn Test Atom Cloud for the Identity and Access Management.

  3. The process should execute in Test mode. When a step completes successfully, it will get a green halo, and you will see a success message when it is done.

  4. Click on the stop shape and View Source on the Shape Source Data tab of the test results and confirm you have reformatted the quote retrieved from the api

 Related articles