Forum Discussion
Hi sachin
If you are expecting JSON, have you tried using (vary the HTTP request as appropriate for your need)
<#assign resp = http.client.request("https", "api.test.com", "/context/path").body("param1=val1", "application/x-www-form-urlencoded").json().post() /> <#if resp.hasError> Error! <#else> <#assign jsonResp = resp.content > ${resp.content} </#if>
Thanks,
Thanks PaoloT
I tried the solution but it did not helped. I am getting freemarker error. Below is the error.
{ "error":"
FreeMarker template error:
Method public final lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel.body(java.lang.String,java.lang.String) throws freemarker.template.TemplateModelException takes exactly 2 arguments, 1 was given.
The failing instruction (FTL stack trace):
----------
==> #assign resp = http.client.request("h... [in template "parsing_poc_remove_later.ftl" at line 1, column 1]
----------
Java stack trace (for programmers):
----------
freemarker.template.TemplateModelException: [... Exception message was already printed; see it above ...]
at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:96)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:107)
at freemarker.core.MethodCall._eval(MethodCall.java:98)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.Dot._eval(Dot.java:74)
at freemarker.core.Expression.eval(Expression.java:111)
Thanks,
Sachin
Related Content
- 3 months ago
- 10 months ago
- 11 years ago