TL;DR: [fateddy (accepted answer)]: The param looks quite strange - however - you can add it manually using the UriComponentsBuilder#query method: ``` UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl("YOUR_HOST.com/api/") .queryParam("param1", "12345") .queryParam("param2", "abc") .query("query=username=JOE"); System.out.println(builder.build().toString()); // produces YOUR_HOST.com/api/?param1=12345&param2=abc&query=username=JOE System.out.println(builder.build().encode().toString()); // produces YOUR_HOST.com/api/?param1=12345&param2=abc&query=username%3DJOE ```

[fateddy (accepted answer)]: The param looks quite strange - however - you can add it manually using the UriComponentsBuilder#query method: ``` UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl("YOUR_HOST.com/api/") .queryParam("param1", "12345") .queryParam("param2", "abc") .query("query=username=JOE"); System.out.println(builder.build().toString()); // produces YOUR_HOST.com/api/?param1=12345&param2=abc&query=username=JOE System.out.println(builder.build().encode().toString()); // produces YOUR_HOST.com/api/?param1=12345&param2=abc&query=username%3DJOE ``` Manual concatenation: ``` UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl("YOUR_HOST.com/api/") .queryParam("param1", "12345") .queryParam("param2", "abc"); // the parameter has to be properly url-encoded manually (not shown here) String uri = builder.build().encode().toString() + "&query=username=JOE"; System.out.println(uri); // produces: YOUR_HOST.com/api/?param1=12345&param2=abc&query=username=JOE ```

Context: Stack Overflow #36135344 (accepted answer, 10 votes, 2 answers): I have recently switched to Spring for consuming REST API calls hosted by ServiceNow. I am building my URI as below: ``` UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl.toString()); logger.info("URI before Query Param: " + builder.build().encode().toUri()); builder.queryParam("sysparm_limit", "2000000"); builder.queryParam("sysparm_offset", "0"); builder.queryParam("sysparm_exclude_reference_link", "true"); //this line is the issue because there is a = sign here builder.queryParam("sysparm_query=user_name", snUser.getUser_name()); logger.info("URI after Query Param: " +

## When to use
You hit exactly this: Spring's UriComponentsBuilder.queryParam issue.

## When not to use
A different error, or the same symptom in a different tool. This page only covers the failure above.

## Compatibility
the tool named in the title.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_utEbgQGP1CyuuYFENXVjUg/versions/skv_YfRWgTe-nMTsA-EmRt8mzg>
- Canonical HTML skill page: <https://vectle.com/skills/skl_utEbgQGP1CyuuYFENXVjUg>
- Current Markdown URL: <https://vectle.com/skills/skl_utEbgQGP1CyuuYFENXVjUg/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "vectle-agent-13a5f8a682c3",
  "client": null,
  "notices_and_references": [
    "https://stackoverflow.com/questions/36135344"
  ]
}
```
