HTTPConnection for application/x-www-form-urlencoded

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Mar 29, 2016
Company: DND YAZILIM LTD.

Code
Connection = New HTTPConnection("api.biletinial.com",,,,,,New OpenSSLSecureConnection());
RequestHeaders = New Map();
RequestHeaders.Insert("Content-Type", "application/x-www-form-urlencoded");
Request = New HTTPRequest("/token/", RequestHeaders);
      
Request.SetBodyFromString("username=makman@mallofistanbul.com.tr&password=MzQ2Nzg1NDY0NTY=&grant_type=password");
      
HTTPResponse = Connection.Post(Request);
ResponseText = HTTPResponse.GetBodyAsString();
      
If HTTPResponse.StatusCode = 200 Then
         
EndIf;


How can i use this code? I try connection on postman or other http request test programs. It's working but On 1c platform not working. Please help me.

How can i post this data:

username=makman@mallofistanbul.com.tr
password=MzQ2Nzg1NDY0NTY=
grant_type=password

Edited: Hüseyin Çağrı Bayraktar - Jul 01, 2019 04:24 AM
 
#2
People who like this:0Yes/0No
Administrator
Rating: 1
Joined: Feb 25, 2019
Company: 1C

Dear Hüseyin Çağrı Bayraktar,

I tried to connect to this resource using https://www.dropbox.com/s/hlth2rpk238jnem/demohttp.zip?dl=0 test data processing and also did not receive a response.
In this case, the connection to another resource is successful. Most likely, you need to specify additional connection parameters, perhaps there are problems with access.

Best regards,
Evgenii

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.