How to consume Rest web services with nested structured request

How to consume Rest web services with nested structured request.

I  was willing to consume REST  web services  using post method for which  i followed the followin steps given  below


2.after consuming automatically two structures were generated Request and Response both are nested structures.

In  request  i used a local variable of structure type in which data been captured from Sql quesries  , but since my request is nested structure so, data was not properly captured so  i used another local variable for the part given in the figure below

the second figure above is the nested part for which i assigned another local variable to captureb data of this part then finally i used again a local variable to collectively get the the complete request

below is th figure of assignment

the first assignment captures the nested part of the structure .

after this the variable is assigned to the run server action given below in figure then after publishing it shows "404 bad request"

Hi Suraj,

I'm a bit confused what you are trying to do. I'm also a but confused by the error, as "bad request" is typically 400, while 404 is "not found" - which one do you get (I assume 400?).

As for the way you build the request, it seems you do not have a nested structure, but a list of structures. Assuming OrderItem.List contains the right data for the GetOrderById2.List.Current order, it seems your assignments are ok (though you could probably fetch the data in a single query, simplifying the logic). The assignment to "FINAL" seems superfluous, why not pass PostGetvatrateapiwithapikeyRequest (you should work on the naming :)) directly to PostGetvatrateapiwithapikey?

I would advise you as a first step to debugging to make sure you set the logging level of the integration to "Full" in Service Center, and check what you are actually sending, and whether this conforms to what the web service is expecting. "Bad request" can mean anything, the web service might even use it to indicate the data itself is wrong, as opposed to the format in which you are sending it.

Yeah it was "400 bad request ",in present scenario i captured  the data in PostGetvatrateapiwithapikeyRequest 

please have a look in below figure

I also used On before request that debugs my request where i found data been captured properly 

below figures will show you the json format of the captured data

But still the request end with exception alert "400 bad request".

I find it easier to check the logging in Service Center, like I said, because you'll get the full HTML headers of both request and response. And like I said, 400 can mean anything, but I doubt the problem is OutSystems related, and you are sending data the REST service does not expect.

I am sorry but are you telling me to debug in service studio or something else ,If "service center" is different can you please send the the link

Hi Suraj,

If you don't know what Service Center is, I'm afraid I can't help you, since this is pretty basic knowledge about the Outsystems Platform. Please refer to training material and/or collegues who do know.

My issue has been resolved .thanks for the help

suraj mukherjee wrote:

My issue has been resolved .thanks for the help

How did you resolve your issue?


Antonio Allen wrote:

suraj mukherjee wrote:Re- arranging  and matching the structure that we get from web service call with the structure where our aqpplication provide the data

My issue has been resolved .thanks for the help

How did you resolve your issue?