My Products
Help

/controller/api/v1/customer/{customerCd} PUT functions very strangely

by ReinderReinders

I am performing an API call to update (PUT) some data on a Customer. This is what happens:

Update some, but not all of the fields of a customer record:

{
    "AccountReference": {
        "Value": "F9"
    },
    "CreditTermsId": {
        "Value": "01"
    },
    "CustomerClassId": {
        "Value": "EUSTD"
    },
    "DefaultPaymentMethod": {
        "Value": {
            "PaymentMethodId": {
                "Value": "9"
            }
        }
    },
    "MainContact": {
        "Value": {
            "Attention": {
            }
        }
    },
    "Name": {
        "Value": "Onno Overloon"
    },
    "OverrideWithClassValues": true,
    "PrintStatements": {
        "Value": false
    },
    "VatRegistrationId": {
        "Value": "213132"
    }
}

 

ScreenId=AR303000

The Payment method is updated:

ReinderReinders_0-1695730939726.png

 

Execute the SAME api call again (same data, paymentmethod 9 is supplied):

ReinderReinders_1-1695730981072.png

Payment method is NOT set to 9 (which was supplied), but set back to the default (1).

 

PUT again --> 9

PUT again --> 1

etc.

 

PUT 5 --> 5

PUT 5 again --> 1

 

It seems that the API endpoint interprets the data as such: "if the current paymentmethod is supplied in a PUT call, remove it and set it to the default value".

This is different behaviour than I have encountered elsewhere (including in the same API call) and it is also not documented.

 

What is the reason and can this be fixed?

 

1 REPLY 1

by Magnus Johnsen

Hi,

If you are sending the below fields in each call, you are choosing to overwrite the values with the default value in the class.

Does the customerClass "EUSTD" have paymentMethod 1 set?

"OverrideWithClassValues": true,
"CustomerClassId": {
        "Value": "EUSTD"
    }