Forum Discussion
Yes, I do remember that there were certain issues with the special chars when we implemented one of our customizations, you need to drill down a bit more.
I investigated the cause a bit deeper and here is something odd about Lithium:
I have another line of code that contains a "?" and this works perfectly. So the character "?" is not an issue.
<#assign url_getTicketsForUserID = baseUrl + "tickets.json?external_id=" + external_id />
<#assign response_getTicketsForUserID = http.client.request(url_getTicketsForUserID).header("Authorization", "Bearer "+ response.content.access_token).json().get() />
When I try this
<#assign url_getUser = baseUrl + "users?query=abc" />
It fails with the following error:
Method "public final lithium.coreapi.webui.template.models.HttpClientResponseTemplateModel lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel.get() throws freemarker.template.TemplateModelException" threw an exception when invoked on lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel object "lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel@66fc9c8f".
When I try the same URL in curl, I get a JSON Object back hence it is a valid command.
The result should be: {"users":[],"next_page":null,"previous_page":null,"count":0}
So what is going on here? Is there anyone from Lithium that can investigate with us on this? We are paying customer and need this roadblock to be resolved before we can launch Lithium.
- YuriK10 years agoKhoros Expert
I think you may need to url encode the query parameter, try the following:
<#assign url_getUser = "https://DOMAIN.zendesk.com/api/v2/users?" + "query=USE
R@COMPANY.com" ?url/>
Hope this helps,Yuri
- perk10 years agoAdept
I tried and a type mismatch happens. url can't be assigned to string. url_getUser isn't defined anywhere else.
<#assign url_getUser = baseUrl + "users/query=user@domain.com" ?url/>
- YuriK10 years agoKhoros Expert
You have a space between the end quote (") and the question mark (?). Try removing the space. Also make sure baseUrl is a string. One other thing is to make sure only the query parameters are encoded. The following worked for me:
<#assign baseUrl = "http://test.test.com/"/>
<#assign url_getUser = baseUrl + "users?" + "query=user@domain.com"?url/>
${url_getUser}Hope this helps,
Yuri
Related Content
- 5 years ago