54.14 MAKE_REST_REQUEST Function

Use this function to invoke a RESTful style Web service supplying either name value pairs, a character based payload or a binary payload and returning the response in a CLOB.


    p_url                   IN  VARCHAR2,
    p_http_method           IN  VARCHAR2,
    p_username              IN  VARCHAR2 DEFAULT NULL,
    p_password              IN  VARCHAR2 DEFAULT NULL,
    p_scheme                IN  VARCHAR2 DEFAULT 'Basic',
    p_proxy_override        IN  VARCHAR2 DEFAULT NULL,
    p_transfer_timeout      IN  NUMBER   DEFAULT 180,
    p_body                  IN  CLOB     DEFAULT EMPTY_CLOB(),
    p_body_blob             IN  BLOB     DEFAULT EMPTY_BLOB(),
    p_parm_name             IN  apex_application_global.vc_arr2
                                    DEFAULT empty_vc_arr,
    p_parm_value            IN  apex_application_global.vc_arr2
                                    DEFAULT empty_vc_arr,
    p_wallet_path           IN  VARCHAR2 DEFAULT NULL,
    p_wallet_pwd            IN  VARCHAR2 DEFAULT NULL,
    p_https_host            IN  VARCHAR2 DEFAULT NULL,
    p_credential_static_id  IN  VARCHAR2 DEFAULT NULL,
    p_token_url             IN  VARCHAR2 DEFAULT NULL )  


Table 54-6 MAKE_REST_REQUEST Function Parameters

Parameter Description
p_url The URL endpoint of the Web service.
p_http_method The HTTP method to use (PUT, POST, GET, HEAD, or DELETE).
p_username The username if basic authentication is required for this service.
p_password The password if basic authentication is required for this service
p_scheme The authentication scheme, Basic (default) or AWS or Digest or OAUTH_CLIENT_CRED if supported by your database release.
p_proxy_override The proxy to use for the request. The proxy supplied overrides the proxy defined in the application attributes.
p_transfer_timeout The amount of time in seconds to wait for a response.
p_body The HTTP payload to be sent as CLOB.
p_body_blob The HTTP payload to be sent as binary BLOB. For example, posting a file.
p_parm_name The name of the parameters to be used in name/value pairs.
p_parm_value The value of the parameters to be used in name/value pairs.
p_wallet_path The file system path to a wallet if the URL endpoint is https. For example, file:/usr/home/oracle/WALLETS. The wallet path provided overrides the wallet defined in the instance settings.
p_wallet_pwd The password to access the wallet.
p_https_host The host name to be matched against the common name (CN) of the remote server's certificate for an HTTPS request.
p_credential_static_id The name of the Web Credentials to be used. Web Credentials are configured in Workspace Utilities.
p_token_url For token-based authentication flows (like OAuth2): The URL where to get the token from.


The following example calls a RESTful-style web service using the make_rest_request function passing the parameters to the service as name/value pairs. The response from the service is stored in a locally declared CLOB.

    l_clob 	CLOB;

    l_clob := apex_web_service.make_rest_request(
        p_url => 'http://us.music.yahewapis.com/video/v1/list/published/popular',
        p_http_method => 'GET',
        p_parm_name => apex_string.string_to_table('appid:format'),
        p_parm_value => apex_string.string_to_table('xyz:xml'));