gpt4 book ai didi

java - 如何修复 URIBuilder getRequest 参数转义

转载 作者:行者123 更新时间:2023-12-02 05:47:48 26 4
gpt4 key购买 nike

在我的代码中,我想在 SugarCRM REST API V10 上启动 GET 请求,对于过滤器,我必须向请求添加一些参数

应该是什么:

https://domain/rest/v10/Accounts?filter=[{"system_uuid_c":"f937456c-fdac-4d90-b1ca-ba31d4eb2922"}]

结果:

https://domain/rest/v10/Accounts?filter%3D=%5B%7B%22system_uuid_c%22%3A%22f937456c-fdac-4d90-b1ca-ba31d4eb2922%22%7D%5D

我的代码:

    filter = filter.concat("[{");
filter = filter.concat("\"system_uuid_c");
filter = filter.concat("\":");
filter = filter.concat("\"");
filter = filter.concat(system_uuid);
filter = filter.concat("\"}]");

URIBuilder builder = new URIBuilder(HOST + PATH);
builder.addParameter("filter", filter);
HttpGet httpGet = new HttpGet(builder.build());

" 对于过滤器很重要。

最佳答案

该网址有效。当 objectMapper 尝试将结果字符串转换为对象时,我收到错误。所以一切都很好:)

感谢您的帮助。

关于java - 如何修复 URIBuilder getRequest 参数转义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56079147/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com