Forum Discussion

Gursimrat's avatar
Gursimrat
Leader
11 years ago

Sample code for making external rest call from endpoint

Can anyone provide a code snippet for making an external rest api call. I am making following call and getting error

 

<#assign response = 
http.client.request("http://external.rest.usrl/restapi/vc/search/messages?q=test").get() />
<#if response.hasError>
${response.error.message}
</#if>

 Content type is text/xml

 


But when I see the endpoint on the view endpointname link, it shows below error "This page contains following errors"Capture.PNG

and when I view its source, it shows, 

html found in response 

1 Reply

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)
    11 years ago

    it seems that your external rest api content contains some data like a html tag. You can either remove the html tag from the content in your external server (if you have controlled to that) or contact Lithium Support to turn on a configure which allows some known html tags in your HTTP client calls.