Forum Discussion
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=USER@COMPANY.com" ?url/>
Hope this helps,
Yuri
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
- perk10 years agoAdept
Hey thanks for the suggestion.
I tried:
<#assign base = "https://our_domain.zendesk.com/api/v2/"/>
<#assign url_getUser = base + "users?" + "query=username@company.com"?url/>
<#assign response_user = http.client.request(url_getUser).header("Authorization", "Bearer "+ response.content.access_token).json().get() />and still received the same error:
FreeMarker template 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@13d041cd". See cause exception. The failing instruction (FTL stack trace): ---------- ==> #assign response_user = http.client.r... [in template "retrieve-org-zendesk.ftl" at line 29, column 25]
Totally at wits ends with what is going on in Lithium...
- YuriK10 years agoKhoros Expert
Can you paste a sample response that you get from the API call here? I'd like to check if JSON parsing is failing here. Also, please check the Content-Type header of the API response is returned as "application/json".
You can also try to remove the .json() and print out the response string to see if you are at least able to get a response at all.
Related Content
- 5 years ago