Headers in HttpRequest

 

Hi Guys,

I'm using Ensemble 2014 and have a code that Posts HttpRequest to a REST API and working fine, but don't know how to add Header to my request!?

I tried  Set Request.SetHeader("Source","Civicview") but it's bringing a Syntax error, any help pls?

Set Request= ##class(%Net.HttpRequest).%New()


 // D Body.%ToJSON()
 Set Request.Server = "devtest.altus.net.au"
 Set Request.Location = "/STP_IF/rest/Employee/CivicCreate"
 //S Request.ProxyAuthorization="SVRWSVMhME4yOlVyYW51czY="
 Set Request.ContentType = "application/json"
 Set Request.SetHeader("Source","Civicview")
 Set Request.SetHeader("PayDate","2017.01.11")

thanks

  • 0
  • 0
  • 362
  • 2
  • 1

Answers

You want to call method SetHeader, so, you should use DO command instead of SET

Do Request.SetHeader("Source","Civicview")