42
Views
16
Comments
Solved
store json to entitiy
Application Type
Mobile

Hi everyone

Im new using outsystems i want to build mobile apps and intergrated with external auth that have been made,

First i want to ask about how to store json to my entitiy, i share my testing oml and anyone can figure it out the error in the logic i made. in the future stored token will be used to verify every function that is called

Best Regards, 

Yansen

 

testing consume api.oml
2021-08-04 12-19-54
Mayank Dharmpurikar
Solution

I have updated the logic in accordance with the API call; please check and let me know if you find any issues.

JWTNew.oml
2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

If you would also share the error you qet in your question, people might even be able to answer your question without opening the oml you shared. 

Regards,

Daniel

UserImage.jpg
yosua yansen

Hi Mr Daniel 

thanks for your response, i try to store the response from rest api to extended user entitiy, can u help me with the logic i made? because the rest api not stored  


UserImage.jpg
SSP

You have called REST API in logic which is returning  single token rather than List.

You don't need to loop it as single token getting. Also you are looping blank structure rather than actual API response. simply you can set CreateExtendUser action with post API response token and delete token looping logic.

Good Luck!

2021-08-04 12-19-54
Mayank Dharmpurikar

Hi yosua,

It would be preferable if you shared the response of your API (since you are calling the local API) so that we could get a sense of the JSON.


UserImage.jpg
yosua yansen

hi mr mayank

thank you for your response, this is the respone from API

{

    "data": {

        "token": "2613ce838b58d8c86b0737058d9cef37430568a479929149e1ca1bb4b3878c7a"

    }

}

i need store this json, and use it for verify every function 

2021-08-04 12-19-54
Mayank Dharmpurikar

Hi ,

Thank you for providing the JSON response.

I updated the OML to meet the requirement and attempted to create a workable solution to give you some ideas. Change it to suit your needs.

NOTE - I used a hardcoded API response; modify it to call the API.

JWTNew.oml
UserImage.jpg
yosua yansen

Hi mr @Mayank Dharmpurikar 

thank you for help, it was workable, so i need to modify the variable using hardcode to call API ? 

2021-08-04 12-19-54
Mayank Dharmpurikar

Yes, I added a comment to the action flow as well.

UserImage.jpg
yosua yansen

can i just doing call API and assign like this ? 

2021-08-04 12-19-54
Mayank Dharmpurikar
UserImage.jpg
yosua yansen

sorry to bother you, why still failed to deserialize it ? something wrong with the logic ? 

2021-08-04 12-19-54
Mayank Dharmpurikar

No Problem Yosua,

In the assign statement directly assign the complete response of your API.

APIRespoonseInJSON = PostLogin.Response
UserImage.jpg
yosua yansen

already try using this before but some error show up " Invalid Data Type

'Text' data type required instead of 'PostLoginResponse'." 

APIRespoonseInJSON = PostLogin.Response

2021-08-04 12-19-54
Mayank Dharmpurikar
Solution

I have updated the logic in accordance with the API call; please check and let me know if you find any issues.

JWTNew.oml
UserImage.jpg
yosua yansen

its worked, thanks you mr @Mayank Dharmpurikar , so we dont need to deserialize the jason right 

2021-08-04 12-19-54
Mayank Dharmpurikar
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.