- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们已经在我们的服务器上安装了 MS Dynamics 365 Business Central(我不知道如何查看当前安装的版本)。我们正在使用 oData v4 我们的请求的协议(protocol)。
任务
我们需要从 PHP 对该系统进行 API 调用
问题
当 GET 请求运行良好时,不可能发出 POST、PATCH、DELETE 请求。
得到
要求:
获取 https://d365bc.vendor.com:7058/attain/ODataV4/Company('{{company}}')/Customer
回复
{
"@odata.context": "https://d365bc.vendor.com:7058/attain/ODataV4/$metadata#Company('...')/Customer",
"value": [
{
"@odata.etag": "W/\"JzQ0O29EcmJmcGs4V3NRMHlEQ0Fxa0JxL1N0bi9xZjY5UDFQakZ0U2tBUGU1Kzg9MTswMDsn\"",
"No": "01121212",
"Name": "Spotsmeyer's Furnishings",
"Responsibility_Center": "",
"Location_Code": "YELLOW",
"Post_Code": "US-FL 37125",
"Country_Region_Code": "US",
"Phone_No": "",
"IC_Partner_Code": "",
"Contact": "Mr. Mike Nash",
"Salesperson_Code": "JR",
"Customer_Posting_Group": "FOREIGN",
"Gen_Bus_Posting_Group": "EXPORT",
"VAT_Bus_Posting_Group": "EXPORT",
"Customer_Price_Group": "",
"Customer_Disc_Group": "",
"Payment_Terms_Code": "1M(8D)",
"Reminder_Terms_Code": "FOREIGN",
"Fin_Charge_Terms_Code": "2.0 FOR.",
"Currency_Code": "USD",
"Language_Code": "ENU",
"Search_Name": "SPOTSMEYER'S FURNISHINGS",
"Credit_Limit_LCY": 0,
"Blocked": " ",
"Privacy_Blocked": false,
"Last_Date_Modified": "2020-06-18",
"Application_Method": "Manual",
"Combine_Shipments": true,
"Reserve": "Optional",
"Shipping_Advice": "Partial",
"Shipping_Agent_Code": "",
"Base_Calendar_Code": "",
"Balance_LCY": 0,
"Balance_Due_LCY": 0,
"Sales_LCY": 0,
"Global_Dimension_1_Filter": "",
"Global_Dimension_2_Filter": "",
"Currency_Filter": "",
"Date_Filter": "..11/13/20"
},
{
"@odata.etag": "W/\"JzQ0O08vNlVHSWVaZ1FGeG42d2JOa3k4Qm5uVHlkSGYzNk1ES2V5Y2E2S3hiekU9MTswMDsn\"",
"No": "01445544",
"Name": "Progressive Home Furnishings",
"Responsibility_Center": "",
"Location_Code": "YELLOW",
"Post_Code": "US-IL 61236",
"Country_Region_Code": "US",
"Phone_No": "",
"IC_Partner_Code": "",
"Contact": "Mr. Scott Mitchell",
"Salesperson_Code": "JR",
"Customer_Posting_Group": "FOREIGN",
"Gen_Bus_Posting_Group": "EXPORT",
"VAT_Bus_Posting_Group": "EXPORT",
"Customer_Price_Group": "",
"Customer_Disc_Group": "RETAIL",
"Payment_Terms_Code": "14 DAYS",
"Reminder_Terms_Code": "FOREIGN",
"Fin_Charge_Terms_Code": "2.0 FOR.",
"Currency_Code": "USD",
"Language_Code": "ENU",
"Search_Name": "PROGRESSIVE HOME FURNISHINGS",
"Credit_Limit_LCY": 0,
"Blocked": " ",
"Privacy_Blocked": false,
"Last_Date_Modified": "2018-09-19",
"Application_Method": "Manual",
"Combine_Shipments": true,
"Reserve": "Optional",
"Shipping_Advice": "Partial",
"Shipping_Agent_Code": "",
"Base_Calendar_Code": "",
"Balance_LCY": 1499.03,
"Balance_Due_LCY": 1499.03,
"Sales_LCY": 1499.03,
"Global_Dimension_1_Filter": "",
"Global_Dimension_2_Filter": "",
"Currency_Filter": "",
"Date_Filter": "..11/13/20"
},
删除
{
"error": {
"code": "BadRequest",
"message": "Entity does not support delete."
}
}
我不确定 Create (POST) 或 Update (Patch) 的正确语法是什么
{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "Entity does not support insert."
}
}
有时,如果我提出绝对错误的请求,我会收到以下回复:
{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "'POST' requests for 'Customer' of EdmType 'Entity' are not allowed within Microsoft Dynamics 365 Business Central OData web services."
}
}
我无法为客户 ProductItems 应用 CUD 操作。但是对于订单,它可以工作。
Setup & Extensions / Manual Setup / Users / [Select User]
https://d365bc.vendor.com:7057/attain/WS/CRONUS%20International%20Ltd/Page/Customer
Extension APIs:
https://<base URL>:<port>/<serverinstance>/api/<API publisher>/<API group>/<API version>
我做的一切正确吗?这些参数是什么意思?指南中没有提供任何解释。
API must be enabled on the Business Central server instance:
The user used for authentication must have a Web Service Access Key (created for the user in Business Central)
The user must have the required permissions within Business Central for the relevant API's.
最佳答案
OData 端点不同于 API 端点。
我建议使用 API,因为它是在 Business Central 中与数据交互的最新且更有效的方式。
API端点的文档可以在这里找到
https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/ ,以及一些示例,例如更新客户、项目等。
您可以使用 OData 修改数据,但前提是驱动终结点的基础对象是页面(而不是查询),并且必须使用 InsertAllowed 进行标记。这没有 API 端点优化。
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/use-odata-to-modify-data
关于api - MS Dynamics 365 商业中心。 API POST、PATCH、DELETE 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64817825/
我们已经在我们的服务器上安装了 MS Dynamics 365 Business Central(我不知道如何查看当前安装的版本)。我们正在使用 oData v4 我们的请求的协议(protocol)
我是一名优秀的程序员,十分优秀!