# REST Connector Dynamic URL

**URL:** <https://community.cdata.com/t/rest-connector-dynamic-url/237>\
**Category:** CData Arc\
**Tags:** question, arc\
**Created:** [July 7, 2023, 9:35pm UTC](https://community.cdata.com/t/rest-connector-dynamic-url/237 "2023-07-07T21:35:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashanth](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@Prashanth](https://community.cdata.com/u/Prashanth)\
**Post date:** [July 7, 2023, 9:35pm UTC](https://community.cdata.com/t/rest-connector-dynamic-url/237/1 "2023-07-07T21:35:27Z")

</div>

REST Connector:

I need to pass the XML input filed in the GET method URL dynamically.

ex: XML input to REST connectgor

\<ZNA\_SHIP\_TRACK\>

\<IDOC\>

\<EDI\_DC40\>

…

\</EDI\_DC40\>

\<ZSHIP\_RESPONSE\>

\<VBELN\>7100124618\</VBELN\>

\<ZAPI\_KEY\> **922f65ee-093a-45fd-8f1f-c61c8050e67e\</ZAPI\_KEY** \>

\</ZSHIP\_RESPONSE\>

\</IDOC\>

\</ZNA\_SHIP\_TRACK\>

REST API should be called with below URL in the GET method:

EX:

“[https://www.client.shipmentstatus.com/api/cn/outbound\_parcel\_shipment/track?parcel\_shipment\_id=](https://www.client.shipmentstatus.com/api/cn/outbound_parcel_shipment/track?parcel_shipment_id=c95540fb-4ceb-427c-a087-7bb4453c2504)”&nbsp; +&nbsp; shipment ID value (XPATH(ZNA\_SHIP\_TRACK/ZSHIP\_RESPONSE/ZAPI\_KEY)

value is

[https://www.client.shipmentstatus.com/api/cn/outbound\_parcel\_shipment/track?parcel\_shipment\_id=](https://www.client.shipmentstatus.com/api/cn/outbound_parcel_shipment/track?parcel_shipment_id=c95540fb-4ceb-427c-a087-7bb4453c2504)[922f65ee-093a-45fd-8f1f-c61c8050e67e](https://www.client.shipmentstatus.com/api/cn/outbound_parcel_shipment/track?parcel_shipment_id=922f65ee-093a-45fd-8f1f-c61c8050e67e)

I have tried numeros method but dynamic URL is not created and throwing error.

---

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [July 10, 2023, 3:54pm UTC](https://community.cdata.com/t/rest-connector-dynamic-url/237/2 "2023-07-10T15:54:13Z")

</div>

I do something very similar..

You can do it in a script connector like this

```xml
<!-- Read XML which is the response from DigiHaul shipment-listing --><arc:set attr="input.uri" value="[FilePath]"/><arc:call op="xmlOpen" input="input"> <arc:set attr="xml.handle" value="[handle]" /></arc:call><arc:set attr="xml.map:shipmentNumber" value="/Shipments/records/shipmentNumber"/><arc:set attr="xml.map:jobId" value="/Shipments/records/jobId"/><arc:try> <arc:call op="xmlDOMGet" in="xml" out="out1"> <arc:set attr="data.shipmentNumber" value="[out1.shipmentNumber]"/> <arc:set attr="data.jobId" value="[out1.jobId]"/> </arc:call><!-- Log Information --><arc:set attr="_log.info">shipmentNumber = [data.shipmentNumber]jobId = [data.jobId]</arc:set><!-- fetch Shipment Details from DigiHaul --><arc:set attr="http.URL" value="https://api.domain.com/carrier/api/shipment-listing/[data.jobId]" /> <arc:set attr="http.header:name#" value="Authorization" /><arc:set attr="http.header:value#" value="Bearer XXXXXXXX"/><arc:set attr="http.verbosity" value="5"/> <arc:set attr="http.logfile" value="D:\cData\logs\my.log"/> <arc:set attr="_log.info">Auth = [http.header:*]URL = [http.URL] </arc:set> <arc:call op="httpGet" in="http"> <arc:set attr="output.data" value="[http:content]" /></arc:call><arc:set attr="_log.info">Response = [output.data]</arc:set> <arc:set attr="output.filename" value="dh-fetch-order-[data.shipmentNumber].json" /><arc:set attr="output.Header:shipmentNumber" value="[data.shipmentNumber]" /><arc:set attr="output.Header:jobId" value="[data.jobId]" /> <arc:finally> <arc:call op="xmlClose" input="xml"/> </arc:finally></arc:try>

```

Use xml **Open and xmlDOMGet** &nbsp;to extract the ID or the parameter you need

Set the http.URL using your parameter

Then use a **HTTPGet** to call your endpoint

hope that helps
