How to do a GET request to a REST Endpoint 

A GET request is send to a REST endpoint to recieve information about a resource. In this case the request body is empty. The following example highlights how a GET request is put to the Paypal Rest API to get Credic Card information.


CREATE OR REPLACE PACKAGE BODY Paypal_Rest AS
	PROCEDURE test_paypal_rest IS
		Query_params PLSQLAP_DOCUMENT_API.Document;
		Url_params PLSQLAP_DOCUMENT_API.Document;
	BEGIN
		Url_params := PLSQLAP_DOCUMENT_API.New_Document('URL_PARAMETERS');
		PLSQLAP_DOCUMENT_API.Add_Attribute(Url_params,'param1', 'v1/vault/credit-cards');
		Query_params := PLSQLAP_RECORD_API.New_Record('QUERY_PARAMETERS');
		PLSQLAP_DOCUMENT_API.Add_Attribute(Query_params,'page_size', '5');
		PLSQLAP_DOCUMENT_API.Add_Attribute(Query_params,'page', '3');
		PLSQLAP_DOCUMENT_API.Add_Attribute(Query_params,'start_time', '2018-05-03T02:51:40Z');

		plsql_rest_sender_API.Call_Rest_EndPoint_Empty_Body2(rest_service => 'PAYPAL_CC_INFO',
                                      				    url_params => Url_params,
                                                    		    callback_func => 'Rest_Test_API.REST_callback_Test',
                                                    		    http_method => 'GET',
                                                    		    http_req_headers => 'Content-Type:application/json',
                                                    		    query_parameters => Query_params);

	END test_paypal_rest;
END Paypal_Rest;


Important points to consider: