<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAP ABAP HTTP Request Post Method using a REST API Call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617178#M2012308</link>
    <description>&lt;P&gt;You need to use &lt;STRONG&gt;client-&amp;gt;request-&amp;gt;add_multipart( )&lt;/STRONG&gt; to transfer files via cl_client_http.&lt;/P&gt;&lt;P&gt;You can find code samples here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2021/12/03/extract-document-details-using-document-information-extraction-service-with-abap/"&gt;https://blogs.sap.com/2021/12/03/extract-document-details-using-document-information-extraction-service-with-abap/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and in answers to two questions:&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/271783/calling-external-rest-api-from-abap-program.html" target="test_blank"&gt;https://answers.sap.com/questions/271783/calling-external-rest-api-from-abap-program.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/471502/how-to-call-multipart-api-to-transfer-file.html" target="test_blank"&gt;https://answers.sap.com/questions/471502/how-to-call-multipart-api-to-transfer-file.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Nov 2022 15:27:14 GMT</pubDate>
    <dc:creator>OlegBash</dc:creator>
    <dc:date>2022-11-13T15:27:14Z</dc:date>
    <item>
      <title>SAP ABAP HTTP Request Post Method using a REST API Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617174#M2012304</link>
      <description>&lt;P&gt;Hi Expers,&lt;/P&gt;
  &lt;P&gt;Our company wants to integrate with a non-SAP product. We've done the GET methods, but we're having trouble with the POST methods. We need to send json data via rest api.The example code shared with us is as follows. I want to transform this code blocks to ABAP language. &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;static void Upload(String url, String path_locator,
String subfolder, String file, String token)
 {
 string requestUrl = string.Format("{0}/RestServices/UploadFile/{1}/{2}/{3}", 
url, 
Base64Encode(path_locator), 
Base64Encode(subfolder), 
Base64Encode(System.IO.Path.GetFileName(file)), 
token);
 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUrl);
 request.Method = "POST";
 request.ContentType = "application/octet-stream";
 // txtFileName contains the name of the file to upload.
 byte[] fileToSend = File.ReadAllBytes(file); 
 request.ContentLength = fileToSend.Length;
 using (Stream requestStream = request.GetRequestStream())
 {
 // Send the file as body request. 
 requestStream.Write(fileToSend, 0, fileToSend.Length);
 requestStream.Close();
 }
 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
 Console.WriteLine("HTTP/{0} {1} {2}", 
response.ProtocolVersion, 
(int)response.StatusCode, 
response.StatusDescription);
 }&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Thank you all.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 09:18:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617174#M2012304</guid>
      <dc:creator>burakozcetinn62</dc:creator>
      <dc:date>2022-11-12T09:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAP ABAP HTTP Request Post Method using a REST API Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617175#M2012305</link>
      <description>&lt;P&gt;Your code is just about doing an HTTP call and encoding using base64, and probably UTF-8 as it sends "octets". I see nothing very specific about JSON.&lt;/P&gt;&lt;P&gt;Concerning HTTP call, base64 and UTF-8, you can find lots of questions and answers in the forum. Search "CL_HTTP_CLIENT", "Base64" and "CL_ABAP_CODEPAGE".&lt;/P&gt;&lt;P&gt;If you have questions about JSON, you can also find many questions and answers in the forum.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 10:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617175#M2012305</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-11-12T10:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAP ABAP HTTP Request Post Method using a REST API Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617176#M2012306</link>
      <description>&lt;P&gt;Yes other parameters will send via url. But how can I send JSON Data? &lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 17:55:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617176#M2012306</guid>
      <dc:creator>burakozcetinn62</dc:creator>
      <dc:date>2022-11-12T17:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAP ABAP HTTP Request Post Method using a REST API Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617177#M2012307</link>
      <description>&lt;P&gt;Could you clarify your question about sending JSON? There could be 12400 different answers.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2112806-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 09:40:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617177#M2012307</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-11-13T09:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAP ABAP HTTP Request Post Method using a REST API Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617178#M2012308</link>
      <description>&lt;P&gt;You need to use &lt;STRONG&gt;client-&amp;gt;request-&amp;gt;add_multipart( )&lt;/STRONG&gt; to transfer files via cl_client_http.&lt;/P&gt;&lt;P&gt;You can find code samples here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2021/12/03/extract-document-details-using-document-information-extraction-service-with-abap/"&gt;https://blogs.sap.com/2021/12/03/extract-document-details-using-document-information-extraction-service-with-abap/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and in answers to two questions:&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/271783/calling-external-rest-api-from-abap-program.html" target="test_blank"&gt;https://answers.sap.com/questions/271783/calling-external-rest-api-from-abap-program.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/471502/how-to-call-multipart-api-to-transfer-file.html" target="test_blank"&gt;https://answers.sap.com/questions/471502/how-to-call-multipart-api-to-transfer-file.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 15:27:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap-http-request-post-method-using-a-rest-api-call/m-p/12617178#M2012308</guid>
      <dc:creator>OlegBash</dc:creator>
      <dc:date>2022-11-13T15:27:14Z</dc:date>
    </item>
  </channel>
</rss>

