0
votes

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?

2
The body of your 500 response contains an error description.Serg Rogovtsev
Sadly, the response means nothing to me. It just tells me that the key I am attempting to update is not in the dictionary followed by a screen dump. The key I am using in the body of my request above is actually the key used in the record I received when I read the record from Acumatica using a GET. It is in exactly the same format as it was received in, just with a different value.Dave Schuler
It could very well mean something for people answering your questions, posting full error messages and call stacks is helpful to debug. Anyways, I posted an answer I think the error is missing quotes for the string parameter value.Hugues Beauséjour
Even if the response doesn't mean anything to you, it might help people who know how the system works to help you. This is why it is advisable to post full error responses, not only HTTP status codes.Serg Rogovtsev

2 Answers

1
votes

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'

1
votes

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