REST Connector Dynamic URL

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=”  +  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=922f65ee-093a-45fd-8f1f-c61c8050e67e

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

I do something very similar..

You can do it in a script connector like this

<!-- 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 xmlOpen and xmlDOMGet 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