Hi,
I am using a REST API (CData source) to get source data. Is it possible to specify that you want to do a POST rather than GET in a CData source?
If so is there any Guide?
Hi,
I am using a REST API (CData source) to get source data. Is it possible to specify that you want to do a POST rather than GET in a CData source?
If so is there any Guide?
Best answer by Thomas Lind
Hi Waqas
Just for reference. The way to do this post call can be done with a file set up like this.
<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. -->
<api:info title="order" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<!-- You can modify the name, type, and column size here. -->
<attr name="klant" xs:type="string" readonly="false" other:xPath="/json/order/klant" />
<attr name="kvk" xs:type="string" readonly="false" other:xPath="/json/order/kvk" />
<attr name="leverancier" xs:type="string" readonly="false" other:xPath="/json/order/leverancier" />
<attr name="OIN" xs:type="string" readonly="false" other:xPath="/json/order/OIN" />
<attr name="omschrijving" xs:type="string" readonly="false" other:xPath="/json/order/omschrijving" />
<attr name="orderdatum" xs:type="datetime" readonly="false" other:xPath="/json/order/orderdatum" />
<attr name="ordernummer" xs:type="string" readonly="false" other:xPath="/json/order/ordernummer" />
<attr name="routering" xs:type="string" readonly="false" other:xPath="/json/order/routering" />
<attr name="status" xs:type="string" readonly="false" other:xPath="/json/order/status" />
</api:info>
<api:set attr="DataModel" value="DOCUMENT" />
<api:set attr="URI" value="https://api.staging.rest.com/webservices/orders/lijst" />
<api:set attr="JSONPath" value="$.order" />
<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="method" value="POST"/>
<api:set attr="contenttype" value="application/json" />
<api:set attr="data">{"order": \[ {} \] }</api:set>
<api:call op="jsonproviderGet">
<api:push/>
</api:call>
</api:script>
</api:script>
This also required an username and password for authentication and it was added to the setup of the data source along with the Auth Scheme type set to Basic Authentication.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.