Updating Customer with REST API

2019-08-27 17:13发布

问题:

I am attempting to to update the Status field of an A/R Customer using the REST API. More specifically I am using OAuth2 authentication, have successfully obtained a token, and am attempting to update the Status field of a single customer record selected by using a $filter.

Here's the request I'm using:

PUT /entity/Default/17.200.001/Customer?$filter=CustomerID%20eq%20ABC HTTP/1.1 Content-Type: application/json; charset=utf-8 Authorization: Bearer 44243e3a1393348480857be1ebc34ff9

with the body of the request:

{"Status": {"value": "Inactive"}}

This returns a 500 error. I am new at integrating with Acumatica. What am I doing wrong?

回答1:

You are missing the single quotes for the 'ABC' parameter value.

For customer ABCHOLDING I get the same error when I try:

/entity/Default/17.200.001/Customer?$filter=CustomerID%20eq%20ABCHOLDING

If I enclose 'ABCHOLDING' in quotes then it works:

/entity/Default/17.200.001/Customer?$filter=CustomerID%20eq%20'ABCHOLDING'



回答2:

Since you are using the key field of the Customer screen, the CustomerID field, have you tried just adding the ID directly in the URL without using the filter parameter?

PUT /entity/Default/17.200.001/Customer/ABC



标签: acumatica