Forum Discussion
YuriK
Khoros Expert
If you remove .json() the response will simply be treated as a string. You should then be able to do ${response_user} to output this string.
perk
10 years agoAdept
Hm, this code is written as an endpoint. A custom component was written for us to process the data generated by the endpoint.
How can I make the same request in the component?
I tried adding this to the component:
<#assign base = "https://domain.zendesk.com/api/v2/"/>
<#assign url_getUser = base + "users?" + "query=email@domain.com" />
<#assign response_user_no_json = http.client.request(url_getUser).header("Authorization", "Bearer "+ token).get() />
${response_user_no_json}
and receive
FreeMarker template error
get(client) failed on instance of lithium.coreapi.webui.template.models.HttpTemplateModel. See cause exception. The failing instruction (FTL stack trace): ---------- ==> #assign response_user_no_json = http... [in template "preview" at line 28, column 29] ----------
If I try removing the client:
<#assign response_user_no_json = http.request(url_getUser).header("Authorization", "Bearer "+ token).get() />
I get :
FreeMarker template error
For "...(...)" callee: Expected a method, but this evaluated to an extended_hash+string (lithium.coreapi.webui.template.models.RequestTemplateModel wrapped into f.e.b.StringModel): ==> http.request [in template "preview" at line 28, column 62] The failing instruction (FTL stack trace): ---------- ==> #assign response_user_no_json = http... [in template "preview" at line 28, column 29] ----------
Any help you can provide here will be very beneficial!
Related Content
- 5 years ago
- 5 years ago