Acumatica REST API客户无法从RestTemplate工作,且url在客户id中带有符号和

Acumatica REST API客户无法从RestTemplate工作,且url在客户id中带有符号和,acumatica,spring-rest,acumatica-kb,Acumatica,Spring Rest,Acumatica Kb,向Acumatica REST API客户发出的Spring RestTemplate请求在客户id在请求中发送的客户id之间有符号和时不起作用 我甚至尝试用下面的givne替换%26,它在Postman工具中工作,但在Spring应用程序中使用restemplate对象时不工作 使用RestTemplate对象在Post man中工作而在my Spring应用程序中不工作的Url是?$filter=CustomerID eq'WESTECH FUEL%26 Equipment'&$expand

向Acumatica REST API客户发出的Spring RestTemplate请求在客户id在请求中发送的客户id之间有符号和时不起作用

我甚至尝试用下面的givne替换%26,它在Postman工具中工作,但在Spring应用程序中使用restemplate对象时不工作

使用RestTemplate对象在Post man中工作而在my Spring应用程序中不工作的Url是?$filter=CustomerID eq'WESTECH FUEL%26 Equipment'&$expand=Main联系人/地址,ShippingContact/地址

使用的Java Spring应用程序代码是

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("authorization", "Bearer iuwnsne9383nx,sowejwew");
HttpEntity<String> header = new HttpEntity<String>(headers);
RestTemplate restTemplate = new RestTemplate();
String url = "https://acumatica.kimballinc.com/AcumaticaERP/entity/sprestprod/6.00.001/Customer?$filter=CustomerID eq 'WESTECH FUEL %26 EQUIP'&$expand=MainContact/Address,ShippingContact/Address"
restTemplate.exchange(url, HttpMethod.GET, header, AcumaticaCustomerVO[].class);
HttpHeaders=newhttpheaders();
headers.setContentType(MediaType.APPLICATION_JSON);
标题。添加(“授权”、“持有人IUWnsEN9383NX、sowejwew”);
HttpEntity标头=新的HttpEntity(标头);
RestTemplate RestTemplate=新RestTemplate();
字符串url=”https://acumatica.kimballinc.com/AcumaticaERP/entity/sprestprod/6.00.001/Customer?$filter=客户ID eq‘WESTECH燃油%26设备’和$expand=主要联系人/地址,发货联系人/地址”
exchange(url,HttpMethod.GET,header,AcumaticaCustomerVO[].class);

我认为RestTemplate会弄乱URL编码方案

似乎有一些变通办法:

  • 将StringHttpMessageConverter添加到模板的消息转换器:

  • 避免RestTemplate交换调用,而是使用UriComponentsBuilder构造URI:


  • 今天晚些时候我会看你的案子,我相信这个问题与spring RestTemplate有关。也许可以使用另一种方法,比如URI:关键部分似乎是:不要将编码的url字符串作为参数传递给RestTemplate.exchange()