HTTP Service with JSON POST

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Aug 11, 2017
Company:

Hi
I need an example.  HTTP Service with JSON POST.

I could not find in the website.
Please could you share an example?

 
#2
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Aug 28, 2015
Company:

Hello.
Here's an example:

JSONString = "";// There are several ways you can create your JSON string
ServerAdress = "localhost";
Resource =  "/api/1.0/sync/product/";
HTTP = New HTTPConnection(ServerAdress,,);

HTTPRequest = New HTTPRequest(Resource);
HTTPRequest.SetBodyFromString(JSONString,TextEncoding.UTF8,ByteOrderMarkUsage.DontUse);
Answer = HTTP.Post(HTTPRequest);
Result = Answer.GetBodyAsString("UTF-8");

Edited: Samir Muqimov - Dec 22, 2017 01:03 AM
 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Aug 11, 2017
Company:

Thank you Samir, Thank you very much.

 
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.