How to receive a JSON as a 'POST' parameter ?

How to receive a JSON as a 'POST' parameter ?

  


Hi Guys,


I'm getting a "POST" in the url of my eSpace, with a parameter called "event". The structure of it is below:





And here is my exposed api:






I'm getting the parameter in json format, as below:






How do I add that data in an entity? I tried to ardoJson, but he asks a text as an input parameter, and I'm getting a 'record'...


thank you in advance for any direction...




 

 
Hi Adelar,

I'm confused as to what you want to achieve. ardoJSON is for parsing JSON, but the platform has already parsed it for you, so you don't need that. You have the data in a native OutSystems Platform structure, so you can do with it whatever you want.
Hi Kilian,
 
First of all, thank you for your time... 
 
I want to know how can I get the data received in that structure, and add to a definitive entity on my system. I try using a "traditional method" of let values from the structure (event.data = myEntity.data) to my entity, but don't work. I know that I'm receiving data, because I have tested with a link on requestbin... but in my endpoint, I can't see or manipulate the received data.
 
Adelar,

I'm can't work out whether you have a problem receiving the data, or storing it in the database. Assuming that you actually receive the data (this can easily be tested by debugging!) you need to copy the data you receive from the REST service to a local variable of whatever type the Entity is, and save it to that entity. This is all really, really basic stuff, and if you have problems with that I'd advise you to either watch the OutSystems training videos or get a developer course.
Kilian Hekhuis wrote:
Adelar,

I'm can't work out whether you have a problem receiving the data, or storing it in the database. Assuming that you actually receive the data (this can easily be tested by debugging!) you need to copy the data you receive from the REST service to a local variable of whatever type the Entity is, and save it to that entity. This is all really, really basic stuff, and if you have problems with that I'd advise you to either watch the OutSystems training videos or get a developer course.
 
Kilian, thanks for the advice.
 
I know this should be a basic thing, and believe me, just posted the question because I really do not understand why I am unable to move the data in this simple way.
 
I have watched all the videos, I follow the forum and my application is composed of several modules, multitenant, with interactions between them, use of timers and send emails ... In other words, I am not an expert, but I'm also not a beginner.
 
Consuming an api, with request and response, it was easy, no problem. And I thought receive this data and treat also would be, but do not know what's going on.
 
But OK. Thanks again for your efforts to help. I will continue trying to find the problem, and when I can, put here to clarify.
 
Thanks,
Hi Adelar,

What do you mean you are "unable to move the data"? I've never seen an assigment statement fail. What do you see when debugging?
Kilian Hekhuis wrote:
Hi Adelar,

What do you mean you are "unable to move the data"? I've never seen an assigment statement fail. What do you see when debugging?
 
 Solved!

I can't debug the exposed API, and I see in this post, why:  https://www.outsystems.com/forums/discussion/15858/debugging-exposed-rest-api-method/

I have tested with my local network, and see what is wrong... My structure was not getting the data, but was returning 'Ok' anyway.
 
It lacked a level in the structure. When completed, it was all ok.
 
thank you.
Hi Adelar,

You should really upgrade then, not being able to debug is a pain! Great to hear you've solved it.