Trying Out API Examples
Users can try out the examples in the documentation by using the "Try it out" button on the examples page.
Before you Begin
-
Identify a server to use to try out the examples. All the API requests will be made to this server.
Note: If any of the APIs create data, such data will be created on the provided server, and cannot be reverted.
-
Enable CORS in the application to allow API requests from the server which hosts the API documentation. Refer to the section "Cross-Origin Resource Sharing" in "Administrator's Guide to Administration Console" for steps to enable CORS.
Configuring a Server and Logging In
Most APIs require a valid session to be able to try out the examples. A valid session can be obtained by logging into the application. The session access token is stored on the client, and used whenever an API is tried out.
To configure a server and login:
-
eGain APIs support clients of the following types: customer, client applications and application users. Go to the login APIs for which you want to start the session:
-
For Interaction, Administration, Authoring, and Knowledge Access APIs, user must login using Login API.
-
For Customer portal APIs, user must login using Login Customer.
-
For Messaging APIs, user must login using Authenticate client application.
-
Provide the server to use for the examples. This is provided in the "API Server" field available in the login page. For example, https://customer.cloud.com/system
-
Use the respective API for logging in. The client is now ready to try out the APIs.
Trying out APIs
Use the latest version of the following browsers to try out the examples: Google Chrome, Mozilla Firefox.
To try out an API:
-
Navigate to the API and click through to the example you want to try out.
-
Click the "TRY IT OUT" button at the end of the example. Note that separate buttons are provided for JSON and XML examples.
-
Make any changes to the headers, form data, or query parameters as appropriate.
-
Provide all required PATH parameters.
-
Provide all required query parameters.
-
Provide supported query parameters as needed.
-
Click the "TRY" button.
-
The API will be executed on the provided server, and the response will populated.
-
The "CLEAR" button will clear the response.
-
If the session is invalid or has expired, the API returns a 401 (Unauthorized) response code. In this case, a login form is displayed to the user to login to the application.