This article will review the GET and POST methods within DQ+'s REST API node. The node also has the ability to utilize PUT, DELETE or HEAD methods, which follow the same principle.
Performing a GET via the REST API Node
The REST API node will run on a per-record basis. It is recommended to have one record feeding into the REST API node to prevent making duplicate API calls.
- Add the REST API node to your Analysis:
- Highlight the node, and within the Properties pane, specify the REST API URL and set the HTTP method to GET:
- If authentication is required, you will either need to use the Authentication, Username and Password properties, or add an Authorization header. This will vary depending on your API endpoint's requirements.
In this example, I am connecting to an API from Data360 Govern, which uses header-based authentication. - To use header-based authentication, click the Add button in the Headers section:
- Select Authorization as the name of the Header:
- Add your authorization string as the Value. For Data360 Govern, this is in the form of <API-KEY>;<API-SECRET> - more information on Data360 Govern APIs can be found here.
- Next, switch to the Response tab within the properties, and specify the output field names to contain the API result:
- For reference, the completed Request tab from previous steps is also below:
- Now you can run the REST API node, and the results will be stored into the three fields specified:
Performing a POST via the REST API Node
This section will assume that you already have data to send through the REST API. Generally, data will be in JSON format to send to the API. Check out our article on How to Create JSON in DQ+ if you need assistance with this.
- Add the REST API node to your Analysis. The input of this node should contain the record(s) of data that you want to send to the API. One API call is made per record.
- Highlight the node, and within the Properties pane, specify the REST API URL and set the HTTP method to POST:
- If authentication is required, you will either need to use the Authentication, Username and Password properties, or add an Authorization header. This will vary depending on your API endpoint's requirements.
In this example, I am connecting to an API from Data360 Govern, which uses header-based authentication. - To use header-based authentication, click the Add button in the Headers section:
- Select Authorization as the name of the Header:
- Add your authorization string as the Value. For Data360 Govern, this is in the form of <API-KEY>;<API-SECRET> - more information on Data360 Govern APIs can be found here.
- Switch to the Request Body tab, and specify the Content Type and Body for your POST request. If your body is coming from a field, then use the notation below, which will reference the input column name specified:
${Column_Name}
For example, the setup below will pull data from the "FullJSON" column and send it as the body of the POST request:
- Next, switch to the Response tab within the properties, and specify the output field names to contain the API result:
- For reference, the completed Request tab from previous steps is also below:
- Now you can run the REST API node, and the results will be stored into the three fields specified:
Comments
0 comments
Please sign in to leave a comment.