1<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
2
3 <api:info title="Post_x-www-form-urlencoded" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
4
5 <attr name="id" xs:type="integer" readonly="false" other:xPath="/json/data/id" />
6 <attr name="extra_id" xs:type="integer" readonly="false" other:xPath="/json/data/extra_id" />
7 <attr name="name" xs:type="string" readonly="false" other:xPath="/json/data/name" />
8 <attr name="date" xs:type="date" readonly="false" other:xPath="/json/data/date" />
9 <attr name="datetime" xs:type="datetime" readonly="false" other:xPath="/json/data/datetime" />
10 <attr name="value" xs:type="long" readonly="false" other:xPath="/json/data/value" />
11 <attr name="bool" xs:type="boolean" readonly="false" other:xPath="/json/data/bool" />
12 <attr name="token" xs:type="string" other:ispseudocolumn="true" />
13 </api:info>
14
15 <api:set attr="EnablePaging" value="true" />
16 <api:set attr="DataModel" value="RELATIONAL" />
17 <api:set attr="DefaultURI" value="https://api.rest.com/v2/data/query" />
18 <api:set attr="_connection._AddToURI" value="f=json&option=1option&transformation=1transformation&token={token}" />
19 <api:set attr="BASEURI" value="[DefaultURI]?[_connection._AddToURI]" />
20 <api:set attr="BASEJSONPath" value="$.data" />
21 <api:set attr="elementmappath#" value="/json/token" />
22 <api:set attr="elementmapname#" value="token" />
23
24
25 <api:script method="GET">
26 <api:set attr="tmp.token" value="" />
27 <api:set attr="method" value="POST"/>
28 <api:set attr="URI" value="https://api.rest.com/v2/data/generateToken" />
29 <api:set attr="JSONPath" value="$" />
30 <api:set attr="contenttype" value="application/x-www-form-urlencoded" />
31 <api:set attr="EncodePostData" value="false" />
32 <api:set attr="data">username=user&password=123456789&api_key=key12345678987654321&grant_type=password</api:set>
33 <api:call op="jsonproviderGet" out="login">
34 <api:set attr="tmp.token" value="[login.token]" />
35 </api:call>
36
37 <api:set attr="method" value="GET"/>
38 <api:set attr="URI" value="[BASEURI | replace('{token}', '[tmp.token | urlencode()]')]"/>
39 <api:set attr="JSONPath" value="[BASEJSONPath]"/>
40 <api:call op="jsonproviderGet">
41 <api:push/>
42 </api:call>
43 </api:script>
44</api:script>