Work with your REST Client
You can use any programming language or tool that support sending and receiving HTTP messages to test REST APIs, as REST APIs use HTTP methods to send and receive content., So, let's first choose a tool for making HTTP requests.
Considerations for Choosing a REST Client
You can choose among many clients that interact with Oracle B2C Service Chat, such as:
- A third-party standalone client, such as Postman or Advanced REST Client.
- Your own custom standalone client. To implement a custom standalone client, see the sample implementation OracleMobileChat.
- Your connecting application's client.
- The cURL command-line utility.
With a client you can:
- Test the username, password, and request URL for your REST API account.
- Construct and send various types of HTTP requests.
How You Send HTTP Requests Using cURL
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. For details, see Installing the cURL Command-Line Tool on Windows.
The following table describes commonly used cURL options that you can use for REST services.
Option | Description |
---|---|
-u |
Specifies the user name and password for server authentication. |
-d |
Sends the specified data (a JSON request body) to the server. If you begin the data with the at sign (@), it must be followed by the file name to read the data from. For example, |
-H |
Specifies an extra HTTP header in the request. To specify multiple headers, precede each header with the
Examples:
|
-o |
Writes the output to a file instead of to standard output. |
-X |
Specifies the request method to use when communicating with the HTTP server. The default method is GET. |
The following table includes examples of REST operations in Oracle B2C Service Chat using cURL.
Operation | cURL Command Example |
---|---|
Use |
|
Use |
|
How You Send HTTP Requests Using Clients
You can use standalone clients, third-party browser extensions, or add-ons, such as the Advanced REST Client, to send HTTP requests.
The following table includes examples of REST operations in Oracle B2C Service Chat using a client.
Operation | Response/Payload Example |
---|---|
POST: Post a message. Use POST with the following request URI and request body to post a chat message to the agent: Request URL:
Request Headers:
Request Body:
|
|
GET: Retrieve queue statistics. Use GET with the following request URI to retrieve engagement queue statistics: Request URL:
Request Headers:
|
|