Trying out the REST API call methods
You can call the REST API using the Swagger UI or from real clients. Review or follow the steps outlined in this topic to learn how you can use either approach to successfully make calls to the BMC Atrium Core REST API.
To configure HTTPS
On BMC Atrium Core you must either configure HTTPS or allow API access over HTTP. Either approach will work for this evaluation exercise, though enabling access over HTTP is only recommended for testing purposes.
Consider the following security implications
- Enabling the REST API access over HTTP is not recommended in production environment and should only be used for testing purposes.
- REST API requests contain your Authentication token in an HTTP header, and are passed in plain text when you use HTTP. If you enable HTTP access to experiment with the REST API, ensure that you revert the configuration.
To call the REST API from the Swagger UI
You can generate the REST client using the by Swagger tools. You can retrieve the Swagger specifications by using the following REST API link:
/api/v1.0/swagger.json
Alternately, you can also use the following Swagger URL:
https://<host name>:<port number>/cmdb/api/help.html
The Swagger UI enables you to explore and interact with all the endpoints in the REST API.
Authenticate with a token from the Swagger UI
Requests to every endpoint in the REST API must be made on behalf of a BMC Atrium CMDB user. The authentication mechanism is token-based, but the Swagger UI enables you to generate a token from the credentials of a valid BMC Atrium CMDB user. For more information about user roles and permissions, see
Roles and permissions
.
When you know that your user has the api-access
permission, click Authorize in the top right of the Swagger UI to display the Available Authorizations dialog box:
Generate a token from any REST client by using the POST method. Add the token to the Authorization screen; then click Authorize to return to the main Swagger UI page. A token is now requested in the background and is added to each subsequent endpoint request. To learn more about authentication and tokens, see
Login information
.
Call an endpoint from Swagger
On the Swagger UI, expand the GET Application Version category and the GET/cmdb/v1.0/version endpoint. Click Try it out! to call the endpoint. A successful request returns the current status of all the BMC Remedy AR System applications. To understand the results structure, click Model in the Response Class section of this endpoint.
Note
Before you try any operations, you must click Authorize at the top-right corner and enter a token prefixed with AR-JWT . For more information, see
Login information
.
Important
Through Try it out! the Swagger UI allows you to call any endpoint in the REST API, but does not provide a sandbox for this experimentation. Some endpoints make changes to the state of the CMDB instance, for example, creating a new CMDB instance or deleting a CMDB instance. Call these endpoints from Swagger UI only if you are comfortable with the changes that are made to BMC Atrium CMDB to which you are connected.
To call the REST API from real clients
The Swagger UI is convenient for experimenting with the REST API. However, for real clients, you can call the REST API from any scripting or programming language that supports HTTP. The following is an example relates to the request sent to the /cmdb
endpoint using curl
:
This documentation uses curl
for giving examples of REST API requests. The Swagger UI also shows the equivalent curl
command for requests.
Regardless of the client language or tool you use to call the REST API, BMC recommends that you first read all related topics to see how to construct valid requests and handle responses.
Comments
Log in or register to comment.