title: How to sent a POST request with form-data and parameters in PL/SQL
body: <p>I'm trying to call REST WebService in PL/SQL but it doesn't work. I get this error:</p>
  
  <blockquote>
    <p><code>Content-type must be multipart/form-data</code></p>
  </blockquote>
  
  <p>Here is what I have:</p>
  
  <pre><code>DECLARE
    req   UTL_HTTP.REQ;
    resp  UTL_HTTP.RESP;
    value VARCHAR2(1024);  -- URL to post to
    v_url VARCHAR2(200) := 'http://local/api/ws';
    -- Post Parameters
    v_param VARCHAR2(500) := 'art=11111\&amp;qty=1'; 
    v_param_length NUMBER := length(v_param);
  BEGIN
    req := UTL_HTTP.BEGIN_REQUEST (url=&gt; v_url, method =&gt; 'POST');
    UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
    UTL_HTTP.SET_HEADER (r      =&gt;  req,
                         name   =&gt;  'Content-Type',
                         value  =&gt;  'multipart/form-data; charset=utf-8; boundary=/');
    UTL_HTTP.SET_HEADER (r      =&gt;   req,
                         name   =&gt;   'Content-Length',
                         value  =&gt;   v_param_length);
    UTL_HTTP.WRITE_TEXT (r      =&gt;   req,
                         data   =&gt;   v_param); 
  
       resp := UTL_HTTP.GET_RESPONSE(req);
    LOOP
      UTL_HTTP.READ_LINE(resp, value, TRUE);
      DBMS_OUTPUT.PUT_LINE(value);
    END LOOP;
    UTL_HTTP.END_RESPONSE(resp);
  EXCEPTION
    WHEN UTL_HTTP.END_OF_BODY THEN
      UTL_HTTP.END_RESPONSE(resp);
  END;
  </code></pre>
  
  <p>Here is an example with CURL :</p>
  
  <pre><code>curl -v -X POST -H "Content-Type: multipart/form-data" -F "art=11111" -F "qty=1" http://local/api/ws
  </code></pre>
  
  <p>This example works fine with curl but i don't know why it doesn't in PL/SQL.
  Can you help me ?   </p>