REST Clients
Because REST APIs use HTTP methods to send and receive content, you can test REST APIs using any programming language or tool that supports sending and receiving HTTP messages. So, let's first choose a tool for making HTTP requests.
Choosing a REST API Client
- A standalone client, such as Postman or Advanced REST Client
- Your connecting application's client
- The cURL command-line utility
With a REST API client you can:
- Test the username, password, and request URL for your REST API account.
- View the appropriate REST API definition to learn more about REST resources, attributes, and parameters.
- Use the collected information to construct and send various types of HTTP requests, such as those to create, update, or delete records.
Supported Headers
Header | Description |
---|---|
Accept |
An Accept Header denotes what type of response the Oracle CPQ REST resource should send back. Follow any of these examples:
|
Content-Type |
A Content-Type Header denotes how the body of the REST call is encoded. Applicable web service calls contain a Content-Type Header
|
Authorization |
An Authorization Header contains the authentication needed to access the system being called. Oracle CPQ user access restrictions apply to REST calls. If a user cannot perform an operation within the Oracle CPQ user interface due to any type of user access restriction, the user will not be able to perform the operation via a REST call. Authorization Headers of calls to Oracle CPQ REST resources must adhere to HTTP Basic authentication standards, and must contain valid, Base64-encoded Oracle CPQ credentials (username:password) for the site being called.
|
Using cURL to Send HTTP Requests
In our examples, we use cURL, a popular command-line utility for transferring data using URL syntax, to send requests to REST services. cURL is available in most UNIX, Windows, and Macintosh environments.
The following table describes commonly used cURL options that you can use for REST services.
Option | Description |
---|---|
-u or --user |
username:password
Specifies the user name and password for server authentication. |
-d or --data | Sends the specified data (a JSON request body) to the server. If you begin the data with the @ sign, then @ must be followed by a file name to read the data from. |
-H or --header | Specifies an extra HTTP header in the request. To specify multiple headers, precede each header with the -H option.
Examples:
|
-o or - -output |
<file>
Writes the output to a file instead of to |
-x or --proxy | Specifies the request method to use when communicating with the HTTP server. The default method is GET. |
The following table shows Oracle CPQ examples of the GET, PATCH, and POST operations using cURL.
Operation | cURL Command Example |
---|---|
Use GET to retrieve all transactions
|
curl -X GET https://sitename.oracle.com/rest/v13/commerceDocumentsOraclecpqoTransaction \ -H 'Authorization: Basic c3VwZXJ1c2VyOnFhUGFzcyEyMzQ=' \ -H 'content-type: application/json' |
Use PATCH to update a user
|
curl -X PATCH 'https://sitename.oracle.com/rest/v13/companies/myCompany/users/Owen.mann' \ -H 'Authorization: Basic c3VwZXJ1c2VyOnFhUGFzcyEyMzQ=' \ -H 'Content-Type: application/json' \ --data-raw '{ "currency": { "value": "USD", "displayValue": "US Dollar" } }' |
Use POST to deploy a data table
|
curl -X POST 'https://sitename.oracle.com/rest/v13/datatables/actions/deploy' \ -H 'Authorization: Basic c3VwZXJ1c2VyOnFhUGFzcyEyMzQ=' \ -H 'Content-Type: application/json' \ --data-raw '{ "selections": ["Racks", "Rack_Components"] }' |
Using REST API Clients to Send HTTP Requests
You can use third-party browser extensions, add-ons, or third party applications, such as Postman, to send HTTP requests. The following section shows examples of the GET, POST, and PATCH operations using a Postman client.
-
Use
GET
request to retrieve all transactions.The following image shows the Postman GET Request.
-
Use
PATCH
to update a user.The following images show the Postman PATCH request header and request body to update a user.
Request Header
Request Body
-
Use
POST
to deploy a data table.The following images show the Postman POST request header and request body to deploy a data table.
Request Header
Request Body