Hi! I have asked a similar question like this before. I am trying to request an API token and use that token inside an API get. I do this because a token is only valid for 23 hours. I need to give the POST a few paramters: A client ID, Client Secret, grant type and a customer ID to identify who I am.
The API documentation says it uses OAUTH2.0 but I have not gotten it to work. I right now have the following code which returns the warning:
<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="API" desc="Generated schema file." xmlns:other=http://apiscript.com/ns?v1>
<!-- You can modify the name, type, and column size here. -->
<attr name="categoryName" xs:type="string" readonly="false" other:xPath="/json/categoryName" />
<attr name="created" xs:type="date" readonly="false" other:xPath="/json/created" />
<attr name="closed" xs:type="date" readonly="false" other:xPath="/json/closed" />
<attr name="description" xs:type="string" readonly="false" other:xPath="/json/description" />
</api:info>
<api:set attr="urlbase" value="https://url.api.nl/" />
<api:set attr="http.url" value="https://url.api.nl/token"/>
<api:set attr="http.header:name#1" value="Accept"/>
<api:set attr="http.header:value#1" value="application/x-www-form-urlencoded"/>
<api:set attr="http.contenttype" value="application/x-www-form-urlencoded"/>
<api:set attr="http.postdata">
{
"client_id":"RANDOMID",
"client_secret":"RANDOMID",
"grant_type":"client_credentials",
"CustomerId":"RANDOMID"
}
</api:set>
<api:set attr="stopin.DataModel" value="DOCUMENT" />
<api:set attr="stopin.JSONPath" value="$" />
<api:set attr="stopin.URITemplate" value="uurlbase]/apiurl" />
<!-- 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">
<!-- New API token is requested-->
<api:call op="httpPost" in="http" out="login">
<api:set attr="Token" value="dlogin.access_token]" />
<!-- New API token is given to the STOPIN call-->
<api:set attr="stopin.Header:Name#1" value="Authorization" />
<api:set attr="stopin.Header:Value#1" value="cToken]" />
<api:set attr="stopin.Header:Name#2" value="X-API-Key" />
<api:set attr="stopin.Header:Value#2" value="RANDOMOD=" />
</api:call>
<api:set attr="stopin.URI" value="stopin.URITemplate]" />
<api:call op="jsonproviderGet" in="stopin" out="stopout">
<api:set attr="out.categoryName" value=" stopout.categoryName]" />
<api:set attr="out.created" value=";stopout.created]" />
<api:set attr="out.closed" value="rstopout.closed]" />
<api:set attr="out.description" value="sstopout.description]" />
<api:push item="out" />
</api:call>
</api:script>
</api:script>