0

I have such xml file, and I want to use the response of the POST request as a variable to use in the next request. I read this link and I didn't find the solution. How can I use shop_id which is the response of the first request in second request?

<request> 
<dyn_variable name="shop_id" re=".*" ></dyn_variable>
<http url="/service/shop" method="POST" version="1.1">
<http_header name="x-auth-id" value="c44e2dcbd271400112ee5def4a1c601d449930276e24fa495c3162f971962088208213b1f2bfba2f04c4fc01c40f00a6ce02abc18da92021ae176e72cecf324d3bf16b398084d84f30c8701696e9f6032661f9854de67ea5be92091e51340e8b77358145"/>
<http_header name="lang" value="fa"/>

</http>
</request>



<request subst="true"> 

<http url="/service/shopping/%%_shop_id%%" method="POST" version="1.1"  > 

<http_header name="x-auth-id" value="c44e2dcbd271400112ee5def4a1c601d449930276e24fa495c3162f971962088208213b1f2bfba2f04c4fc01c40f00a6ce02abc18da92021ae176e72cecf324d3bf16b398084d84f30c8701696e9f6032661f9854de67ea5be92091e51340e8b77358145"/>

<http_header name="lang" value="fa"/>
<http_header name="Content-Type" value="application/json"/>


</http> </request>
Paniz
  • 594
  • 6
  • 19

1 Answers1

0

Did you try the solution from that link?

Looking at your example request, where you try to set the shop_id, you are missing exactly that:

<request subst="true">

Therefore, instead of:

<request> 
<dyn_variable name="shop_id" re=".*" ></dyn_variable>
<http url="/service/shop" method="POST" version="1.1">
...

Try this

<request subst="true"> 
<dyn_variable name="shop_id" re=".*" ></dyn_variable>
<http url="/service/shop" method="POST" version="1.1">
...
diarpi
  • 86
  • 7
  • Thanks for your attention, but the `subst="true"` is only necessary for the second request in which I wanna use the parameter not the first one, and I have used it. – Paniz Jun 06 '17 at 06:00
  • Actually, you need to specify it in both cases. Check the examples from the official documentation. – diarpi Jun 06 '17 at 10:59