Update Problem in REST service

Update Problem in REST service

  

Hi, I am trying to learn about REST API service in outsystems so I planned to do simple get create update and delete funtions in REST API. All works fine except Update. I've attached an OML please take a look and tell me where I've gone wrong.


Problem is Update screen appears to be non editable. Please tell me how to fix it.

On your form the enabled property is set to false.

Stacey Levine wrote:

On your form the enabled property is set to false.


Thank you. I didn't see it coming ;) .

Stacey Levine wrote:

On your form the enabled property is set to false.


I changed but still there is some problem in update function still. Its not updating (not reflecting the change in database). Please help.

Hello Sathish,

I do not understand your use case here, as you could simply manipulate your DB directly using Aggregates/SQL on every action (Create, Update, Delete), but I assume you are just aiming at using REST APIs with OutSystems.

The problem is: you need to expose your APIs and build the logic associated to each one of them (Creating, Updating, etc), instead of consuming them. This way, you can later use their endpoint to call them (locally within the application or remotely from other applications), to perform actions over your DB.

As of now, you are consuming APIs which do not exist on your application.

Best regards,

Pedro Santos

Pedro Santos wrote:

Hello Sathish,

I do not understand your use case here, as you could simply manipulate your DB directly using Aggregates/SQL on every action (Create, Update, Delete), but I assume you are just aiming at using REST APIs with OutSystems.

The problem is: you need to expose your APIs and build the logic associated to each one of them (Creating, Updating, etc), instead of consuming them. This way, you can later use their endpoint to call them (locally within the application or remotely from other applications), to perform actions over your DB.

As of now, you are consuming APIs which do not exist on your application.

Best regards,

Pedro Santos


I did already published(Exposed) it on another application. Take a look at this oml.

Hi Sathish,

I apologize for that, it was unclear to me.

I know what the problem is: the variable for each Input widget inside your Form (ProductsForm) is not correctly defined, as they point to the response of your GetProducts call, instead of the entries of the Record itself (within the Form).

So basically:

  • Input widget (Products_Id)
    • Variable: GetProducts.Response.Current.Id >> ProductsForm.Record.Id
  • Input widget (Products_Name)
    • Variable: GetProducts.Response.Current.Name >> ProductsForm.Record.Name
  • Input widget (Products_Description)
    • Variable: GetProducts.Response.Current.Description >> ProductsForm.Record.Description
  • Input widget (Products_Price)
    • Variable: GetProducts.Response.Current.Id >> ProductsForm.Record.Price


This way, when you call the UpdateProduct API with ProductsForm.Record as input, information will be propagated. Otherwise, it won't.

I hope this fixes your issue!

Sincerely,

Pedro Santos

Pedro Santos wrote:

Hi Sathish,

I apologize for that, it was unclear to me.

I know what the problem is: the variable for each Input widget inside your Form (ProductsForm) is not correctly defined, as they point to the response of your GetProducts call, instead of the entries of the Record itself (within the Form).

So basically:

  • Input widget (Products_Id)
    • Variable: GetProducts.Response.Current.Id >> ProductsForm.Record.Id
  • Input widget (Products_Name)
    • Variable: GetProducts.Response.Current.Name >> ProductsForm.Record.Name
  • Input widget (Products_Description)
    • Variable: GetProducts.Response.Current.Description >> ProductsForm.Record.Description
  • Input widget (Products_Price)
    • Variable: GetProducts.Response.Current.Id >> ProductsForm.Record.Price


This way, when you call the UpdateProduct API with ProductsForm.Record as input, information will be propagated. Otherwise, it won't.

I hope this fixes your issue!

Sincerely,

Pedro Santos


No need to apologize. You fixed it anyway. Thanks. I also need to ask you something. For the start I worked on this simple get create update and delete funtions on REST API. 

As I have some idea about it now. What are the things I need to practice or study to get know about the REST API and what are the things it is capable of . 

Is there any sample application which explains what does and what can the REST API can do in outsystems or Do you have any idea in your mind for what am seeking? 

Good, that your problem is solved!

I would recommend you search online for available documentation and how-tos on the matter, like for instance:

https://www.outsystems.com/forge/component-details/926/How+to+Expose+a+REST+API/

http://www.slideshare.net/OutSystems/9-out-systems-rest-made-easy-nextstep-2014

There is a lot of information online, at a one-click (and some typing) distance!

Cheers,

Pedro