Trying out the REST APIs - Documentation for TrueSight Server Automation 23.1
Emma Powell To configure HTTPS access
In order to use the REST API over HTTPS, you must specify the port number that corresponds to your security. The default port is 9843.
To access the Swagger UI
Do the following:
- Start your web browser.
Enter the URL in the following format:
Syntax:
hostname>:<port>/rest/apidocsExample:
- (Optional) For future reference, bookmark this URL.
This launches the Swagger UI, which enables you to explore and interact with all endpoints in the REST API.
To obtain the authentication token
Requests to every endpoint in the REST API must be made on behalf of a TrueSight Server Automation user. The authentication mechanism is session-based. The Swagger UI lets you generate a session from the credentials of a valid TrueSight Server Automation user who is granted the right to login using web services.
- In the Swagger UI, click the Sessions link.
- Under Sessions, click Post.
- Click Try it out.
- In the Parameters section, enter the TrueSight Server Automation username, password, role, and authentication type.
- A session is now requested in the background. The
session_idattribute in the Response Body section contains the generated session ID, which you can use for authentication in subsequent requests.
To authorize the session
After obtaining the session ID, you must authorize the session. Do the following:
- In the top-right corner, click Authorize
.
- Use one of the following authentication methods:
- Authorization (apiKey)
In the Value field, enter the authorization header or the Remedy Single Sign-On token, and click Authorize. For information about obtaining the Remedy Single Sign-On token, see Implementing Remedy Single Sign-On authentication. - api-key (apiKey)
This authentication method is deprecated. BMC recommends using the authorization header. - api-role (apiKey)
In the Value field, enter the user role and click Authorize. By default, the value of the default_role attribute ofPOST: /api/v1/sessionsAPI response is used.
- Authorization (apiKey)
- Click Close.
To call an endpoint from Swagger
After authorizing the session, you can execute subsequent requests.
- To try out other endpoints, such as servers, expand the applicable section and click on the method.
- To access the request parameter input fields, click Try it out.
Enter the request parameters, and click Execute.
Try it out!
The Swagger UI enables you to call any endpoint in the REST API, but it does not provide a sandbox for this experimentation.
To download a copy of the REST API to a local system
If you prefer to experiment with a local copy of the API, you can click the file name at the top of the page to open the file in a text editor.