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

You can choose among many REST API clients that interact with Oracle CPQ, such as:
  • 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

The following Header types can (and in some cases must) be included in calls to Oracle CPQ REST resources:
Header Description
Accept

An Accept Header denotes what type of response the Oracle CPQ REST resource should send back.

Follow any of these examples:

  • Accept: application/json
  • Accept: application/schema+json
  • Accept: application/octet-stream
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

  • Content-Type: application/json
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.

  • Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQg

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:
  • Content-Type: Format of request body (for example, with POST)
  • Accept: Format of response body
  • Authorization: Type of authorization (for example, Basic Auth, Bearer Token, OAuth 2.0)
-o or - -output <file>

Writes the output to a file instead of to stdout.

-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.

    Postman Get All Transactions example

  • Use PATCH to update a user.

    The following images show the Postman PATCH request header and request body to update a user.

    Request Header

    Postman PATCH Header example

    Request Body

    Postman PATCH Body example

  • 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

    Postman POST Header example

    Request Body

    Postman POST Body example