How to expose API Method Update ?

How to expose API Method Update ?

  

Hi, I have a problem on my expose API update. And after I try it in postman, the API was error 

{
    "Errors": [
        "[OSDEV1].DBO.[OSUSR_9AT_SALES] with key 0 was not updated"
    ],
    "StatusCode": 500
}

It there any steps that I miss ? Just tell me if you know. Thank you before.

Hi Sabdo,

What are you trying to update in the UpdateCustomer? From where does that record come?

Also, you do not have any input parameters to your method? It always updates the same record?

Cheers,

José

Hi Sabdo,

Just pass to your action the entity(as input parameter) with the changed values and inside your action pass it to the UpdateCustomer.

And check the learning section of the OutSystems website https://www.outsystems.com/learn/

Best regards,

João Nobre


Hi Sabdo,

I am guessing there are problem in your record which you are giving for update.

If you can send the OML then I can fix the issue you are facing.


Regards

-SK-

Shashi kant Shukla wrote:

Hi Sabdo,

I am guessing there are problem in your record which you are giving for update.

If you can send the OML then I can fix the issue you are facing.


Regards

-SK-

Hi Shashi, 

Ok, this is my oml. Thank's before.


Hi Sabdo,

What values are you passing as input parameter of the REST service? Does the Id value of the Customer, of the input variable, exists, in a record, in your Customer Entity?

Cheers,

José

Hi Sabdo,

I think you are facing the problem while consuming the API but you didn`t use this API in your code.

Can you please give the oml where you are exposing the API ?


Regards

-SK-

Sorry Sabdo,

You have provided the code for exposing the API


Regards

-SK-

Shashi kant Shukla wrote:

Hi Sabdo,

I think you are facing the problem while consuming the API but you didn`t use this API in your code.

Can you please give the oml where you are exposing the API ?


Regards

-SK-


Hi Shashi, 

Just for your information. That was also the oml that I exposing the API. My Expose API name is UpdateSales in Logic tab.

Regards, 

Sabdo

José Costa wrote:

Hi Sabdo,

What values are you passing as input parameter of the REST service? Does the Id value of the Customer, of the input variable, exists, in a record, in your Customer Entity?

Cheers,

José


Hi Jose, 

My input parameter data type was Customer. I don't have any idea to make my parameters just for PhoneNumber and Name.


Regards, 

Sabdo

Hi Sabdo,

What is the value of the Id attribute of the "input" variable? Does it exist in any record in the entity Customer?

Cheers,

José

José Costa wrote:

Hi Sabdo,

What is the value of the Id attribute of the "input" variable? Does it exist in any record in the entity Customer?

Cheers,

José

Hi Jose,

Is this one like what you mean ? 

Regards, 

Sabdo

Solution

Hi Sabdo,

You can create API with 2 input parameter CustomerId & NewPhoneNumber



You can call the API as below:


And Provide the customerid & New Phone number to update



I have tested it is working now


Regards

-SK-

Solution

Shashi kant Shukla wrote:

Hi Sabdo,

You can create API with 2 input parameter CustomerId & NewPhoneNumber



You can call the API as below:


And Provide the customerid & New Phone number to update



I have tested it is working now


Regards

-SK-


Hi Shashi, 

Thank's for your help. That's really helpful for me.

Regards, 

Sabdo