How to pass JSON data to POST REST data source?

How to pass JSON data to POST REST data source?

book

Article ID: KB0077209

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All supported versions

Description

How to pass JSON data to POST REST data source

Issue/Introduction

How to pass JSON data to POST REST data source?

Resolution

The POST REST data source is most often configured to accept a set of the scalar parameter as inputs. Those inputs are then used to populate a POST request document. Using the REST data source, typically with a POST verb, parameters can be specified that encode into the body of the request. Typically, the parameter name is used to delimit the parameter. 

Here are the steps:
  1. Define your REST data source.
  2. Select the checkbox next to the JSON Format label.
  3. In the Basics tab, scroll further down to the Operations section.
  4. Define the details for your operation, including the HTTP Verb, Operation Name, and Operation URL.
  5. In the Header/Body Parameters table, add a Param Name named [rawdata] with a Data Type of varchar. This is a Body parameter of direction IN.
  6. In the Header/Body Parameters table, add a Param Name named Content-Type with a Data Type of varchar. This is a Body parameter of direction IN.
  7. In the Header/Body Parameters table, add a Param Name named response with a Data Type of the desired type. This is a Body parameter of direction OUT.

When you run operation, set "Content-Type" to "application/json" which is Official MIME type for json

[rawdata] is used to hold the JSON input payload.