Updating Customer with REST API

折月煮酒 提交于 2019-12-11 22:54:14

问题


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



来源:https://stackoverflow.com/questions/53109601/updating-customer-with-rest-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!