Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.28 KB | None | 0 0
  1. DECLARE
  2.   req UTL_HTTP.req;
  3.   res UTL_HTTP.resp;
  4.   url VARCHAR2(4000) := 'http://apiinspector.multeo.net/auth';
  5.   buffer VARCHAR2(4000);
  6.   body_content VARCHAR2(4000) := '{"grant_type":"admin", "client_id": "multeo", "client_secret": "Kww9ZcyQVyvQXyCTeuhf769HULAR8nMJ", "document": "000001","password": "TD54A8aWdKgfbRGs"}';
  7. BEGIN
  8.  
  9.   DBMS_OUTPUT.put_line(LENGTH(content));
  10.   req := UTL_HTTP.begin_request(url, 'POST',' HTTP/1.1');
  11.   UTL_HTTP.set_header(req, 'user-agent', 'mozilla/4.0');
  12.   UTL_HTTP.set_header(req, 'Accept', 'application/x.api.v1+json');
  13.   UTL_HTTP.set_header(req, 'cache-control', 'no-cache');
  14.   UTL_HTTP.set_header(req, 'Content-Type', 'application/json');
  15.   DBMS_OUTPUT.put_line(LENGTH(body_content));
  16.   UTL_HTTP.set_header(req, 'Content-Length', LENGTH(body_content));
  17.   DBMS_OUTPUT.put_line(body_content);
  18.   UTL_HTTP.write_text(req, body_content);
  19.   res := UTL_HTTP.get_response(req);
  20.   -- process the response from the HTTP call
  21.   UTL_HTTP.read_line(res, buffer);
  22.   DBMS_OUTPUT.put_line(buffer);
  23.   /*
  24.   begin
  25.     loop
  26.       utl_http.read_line(res, buffer);
  27.       dbms_output.put_line(buffer);
  28.     end loop;
  29.     utl_http.end_response(res);
  30.   exception
  31.     when utl_http.end_of_body
  32.     then
  33.       utl_http.end_response(res);
  34.   end;
  35.   */
  36. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement