Acumatica 以编程方式使用 $filter 给出 HTTP 400 错误请求
Acumatica Using $filter programmatically gives HTTP 400 Bad request
我在我的 php 代码中使用这个 url
https://awesomedomain.app/entity/Default/18.200.001/SalesOrder?$filter=Status eq 'Completed'
像这样:
$acumaticaOrder = $this->Acumatica_API("/entity/Default/18.200.001/SalesOrder?$" . 'filter' . "=Status eq 'Completed'", 'GET');
但它给出 “错误请求” 错误
然而,我在 Postman 中使用相同的 link,但它给我那些标记为已完成的订单。
我什至检查了我正在制作的 URL 并在 Postman 中复制粘贴了相同的 URL,在 Postman[=32] 中=] 它有效。但它以编程方式给出了 HTTP 400 Bad request。
您的字符串结构应如下所示:
$url = 'http://localhost/Acumatica20R2DB/entity/Default/20.200.001/SalesOrder?$filter=Status%20eq%20%27Completed%27';
单引号会让 PHP 忽略您的 $ 并且您需要在过滤器中对空格和 ' 使用 html 编码。
我在我的 php 代码中使用这个 url
https://awesomedomain.app/entity/Default/18.200.001/SalesOrder?$filter=Status eq 'Completed'
像这样:
$acumaticaOrder = $this->Acumatica_API("/entity/Default/18.200.001/SalesOrder?$" . 'filter' . "=Status eq 'Completed'", 'GET');
但它给出 “错误请求” 错误
然而,我在 Postman 中使用相同的 link,但它给我那些标记为已完成的订单。
我什至检查了我正在制作的 URL 并在 Postman 中复制粘贴了相同的 URL,在 Postman[=32] 中=] 它有效。但它以编程方式给出了 HTTP 400 Bad request。
您的字符串结构应如下所示:
$url = 'http://localhost/Acumatica20R2DB/entity/Default/20.200.001/SalesOrder?$filter=Status%20eq%20%27Completed%27';
单引号会让 PHP 忽略您的 $ 并且您需要在过滤器中对空格和 ' 使用 html 编码。