Test
You should always test the REST APIs, their resources, and their parameters before you implement any REST calls. When you test, you need an application that interacts with the REST API. You can also use either cURL commands or REST clients to test REST APIs before you implement them in your application.
Testing with cURL
cURL is a command-line tool for transferring data using URL syntax. Here are some of the most common cURL options to test REST APIs:
Option | Description |
-user |
username:password Specifies the user name and password for server authentication. |
-d |
Sends the specified JSON request body to the server. If you begin the data with the |
-H |
Specifies an extra HTTP header in the request. To specify multiple headers, precede each header with the |
-output |
<file> Writes the output to a file. |
-X |
Specifies the request method to use when communicating with the HTTP server. The default method is GET. |
Here are some examples that show how to use cURL with GET
, PATCH
, and POST
operations:
Operation | cURL Command |
Use |
curl -i -u "<username>:<password>" -X GET https://<host>:<port>/hcmRestApi/resources/<version>/emps/ |
Use |
curl -u username:password -X PATCH -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -d 'request payload' "server:port/fscmRestApi/resources/latest/workOrders/WorkOrderId" |
Use |
curl --user sales_cloud_user -X POST -d @example_request_payload.json https://your_organization.com:port/hcmRestApi/resources/<version>/accounts |