Powerbuilder GET request with request headers -
i'm accessing restful api using powerbuilder. have working fine however, call api , include request headers. reason need because api accepts "content-type" request header, can set either "application/xml" or "application/json".
here have done far:
inet iinet_base n_ir ir getcontextservice( "internet", iinet_base ) create n_ir li_rc = iinet_base.geturl( "http://api.com/apicall", ir ) ls_result = ir.of_getresultdata_string()
the above return data expected. request must request, not post.
how add request header geturl request?
ended not using inet object , instead using else. long story short, i'm using oleobject this
lole_send.connecttonewobject("msxml2.domdocument.6.0") lole_srvhttp.connecttonewobject("msxml2.serverxmlhttp.6.0") lole_srvhttp.open("get", "http://api.com/apicall", false) lole_srvhttp.setrequestheader( "content-type", "application/json") lole_srvhttp.send(lole_send) ls_message = string(lole_srvhttp.status) ls_response = string(lole_srvhttp.responsetext)
there more it, start else trying find answer this.
Comments
Post a Comment