Call Rest Response

0
Hello   I successfully created a post rest call configuring response as below   I need to keep the response, preferably ImportMapping2, for further manipulation in my application. For example, based on the response, I need to open pages. I need the response as a Global variable on client side, as long as the browser or session is on. I should be able to read and edit that variable. How can i achieve that?   Thank you
asked
8 answers
1

Hi, 

If you want to keep this object global, you can create a association with user entity and upon receving the output via the rest call simply update the association and commit and that will do it. You will now can access the response object anywhere in the session by retreving it from the [%currentuser%] token.  

answered
1

Hi, 

You cannot create a custom session variable in Mendix. Refer this question this is similar to you scenario https://forum.mendix.com/link/questions/92757 . Hope this helps! 

answered
0

Hi

Thank you for reply. 

I actually do not have a user entity, neither any other persistable entities at domain level. To test the Rest call, i just used call rest object in the microflow. All used entities are non persistable

 

answered
0

Hello again

 

I attached some screen shots

Domain model

 

 

I need to save replyAPI 

 

I was unable to get the association replyAPI_User to save the variable replyAPI into it

Kindly advise

 

Thank you

answered
0

Hello

i could progress by the following

 

i was however unable to call the replyAPI in other microflows

 

Kindly advise

Thank you

 

answered
0

Hi

 

I was unable to create the xpath on the micorflow, how can i do that?

Anyway, I created a grid on the page, but got the errors

 

[MyFirstModule.replyAPI_User/MyFirstModule.replyAPI/MyFirstModule.replyAPI_User/System.User/id = '[%CurrentUser%]']

 

 

I got the following errors when making the 1 to 1 relationship

 

answered
0

Hi

I still could not progress. please send me more details on the solution.

To sum up, i created a non persistant entity and associated it to User. 

 

I do a call Rest and output it to the non persistent entity

 

I then associate it using create object

 

 

I need to call that entity in another microflow

 

I tried the following in another microflow

all the variables in the entity are empty

answered
0

Hi Mohammad Reza Dowlut,

Firstly  instead of creating association to  system.user you can also create a assoication to system.session object. 
After the post Rest call is done you wil get an object Login.Reply. Next to post call  use a change object on Login.reply and in the LoginReply_Session assoicaiton set the $currentsession token. Instead of create object you should do a change object object on the LogiReply  object. 
Now you can retrieve the LoginReply obejct with your current session token in the microflow. 

Thanks,
Dinesh

answered