Sending post Request with ContentType:"application/x-www-form-urlencoded"

Primary tabs

Having difficulty with sending POST request.

How I can send parameters in the body of request, if i'm using ContentType:"application/x-www-form-urlencoded".

Version of ensemble: 2010

My code is bellow:

Set httpRequest=##class(%Net.HttpRequest).%New()
set httpRequest.SSLConfiguration="1"
Set httpRequest.ContentCharset="utf-8"
Set httpRequest.Server=""
Set httpRequest.Port=443
Set httpRequest.Https=1
Set httpRequest.Location = "/auth/key"
set httpRequest.ContentType="application/x-www-form-urlencoded"
Set httpRequest.ContentCharset="utf-8"    
do httpRequest.EntityBody.Write("grant_type=client_credentials&scope=num&client_id=random")
Set httpRequest.Timeout=119
do httpRequest.Post("",2)

the result

User-Agent: Mozilla/4.0 (compatible; Cache;)
Connection: Close
Accept-Encoding: gzip
Content-Length: 112
Content-Type: application/x-www-form-urlencoded



Hello Sir,
I can see that you are calling api of Sciener Open Platform. I also need to implement the same. I only need to implement the Web API. And I can see that first we have to create an user that I created. But How can I create a company and how can I get the client_id and client_secret? Can you please suggest me? I appreciate your help.

Thank You.