Using the REST API with Swagger
The REST endpoints exposed by the Remedy AR System Server are documented by using Swagger specifications. This topic provides guidelines for using Swagger UI. In addition to the Swagger UI, you can view the endpoints provided by this REST API in the End point documentation page.
Accessing AR REST API through Swagger UI
The Swagger UI shows a list of endpoints on a web page. You can read and submit requests after authentication. The following process explains how to access AR REST APIs through the Swagger UI.
You must enable CORS (Cross Origin Resource Sharing) on the AR System Server. The CORS headers are configured as Centralized Configuration settings.
- Access-Control-Allow-Credentials
- Access-Control-Expose-Headers
- Access-Control-Allow-Headers
- Access-Control-Allow-Methods
- Access-Control-Allow-Origin
For more information, see Configuration-settings-A-B.
To download the Swagger UI
- In a web browser open the following URL:
https://github.com/swagger-api/swagger-ui - Click the Clone or download button and select the Download Zip option.
- Save the downloaded file to some location on your computer and extract the contents of the file.
- From the extracted folder, copy the dist folder and rename the dist folder to swagger-ui.
To deploy Swagger UI in a Web container
The following procedure explains how to deploy Swagger UI in Apache Tomcat.
- Move the swagger-ui folder from your custom location to Tomcat\webapps folder.
For example, C:\Program Files\Apache Software Foundation\Tomcat7.0\webapps - From the swagger-ui folder, open the swagger-initializer.js file.
- In the swagger-initializer.js file, search for SwaggerUIBundle.
Replace the url section below the SwaggerUIBundle with the URL details having the following syntax:
urls: [
{url:"http://<AR Server IP address>:<Jetty Server Port>/api/arsys/v1.0/swagger/ars-jwt.json", name:"JWTResource"},
{url:"http://<AR Server IP address>:<Jetty Server Port>/api/arsys/v1.0/swagger/ars-entry.json", name:"EntryResource"},
{url:"http://<AR Server IP address>:<Jetty Server Port>/api/arsys/v1.0/swagger/ars-fields.json", name:"FieldsResource"},
{url:"http://<AR Server IP address>:<Jetty Server Port>/api/arsys/v1.0/swagger/ars-menu.json", name:"MenuResource"},
{url:"http://<AR Server IP address>:<Jetty Server Port>/api/arsys/v1.0/swagger/ars-webhook.json", name:"WebhookResource"}
],For example:
urls: [
{url:"http://ARSERVER:8008/api/arsys/v1.0/swagger/ars-jwt.json", name:"JWTResource_Name"},
{url:"http://ARSERVER:8008/api/arsys/v1.0/swagger/ars-entry.json", name:"EntryResource_Name"},
{url:"http://ARSERVER:8008/api/arsys/v1.0/swagger/ars-fields.json", name:"FieldsResource_Name"},
{url:"http://ARSERVER:8008/api/arsys/v1.0/swagger/ars-menu.json", name:"MenuResource"},
{url:"http://ARSERVER:8008/api/arsys/v1.0/swagger/ars-webhook.json", name:"WebhookResource"}
],The default Jetty Server Port is 8008.
- (Optional) Turn off the Swagger schema validation by adding validatorUrl: null, in the SwaggerUIBundle.
To authenticate the AR REST API
- Open the following URL in the web browser:
http://<localhost>:<Tomcat port>/swagger-ui/
The default Tomcat port is 8080. - From the Select a definition drop-down, select JWTResouce.
- Click on the /jwt/login API.
- Click Try it out!.
- Enter details such as username and password and then click Execute.
Status code 200 is displayed. - Copy the text in the Response body.
The copied text is a token to authenticate REST APIs. - From the Select a definition drop-down on the right hand corner, select EntryResource (for entry APIs) or FieldsResource (for field APIs).
- Click Authorize.
The Available authorization dialog-box is displayed. - In the text-box, enter AR-JWT, space, and paste the copied token.
- Click Authorize and close the dialog box.
You can now access any AR REST API by entering relevant field information. For more information, see Endpoints-in-AR-REST-API.
Using the RSSO_Oauth2 authentication with Swagger UI
If you have Remedy Single Sign-On (RSSO) installed, you can use the RSSO_Oauth2 authentication scheme through the Swagger UI. The following process explains how to access AR REST APIs through OAuth2 authentication.
Before you begin
Make sure that the Cross-domain requests are allowed on the Remedy SSO Server.
You can enable the Cross-domain requests on Apache Tomcat. For more information, see https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter. An error occurs if Cross-domain requests are not enabled.
To register clients in the Remedy SSO Console
- Register the Swagger UI as a Remedy SSO client in the Remedy SSO Console. For more information, see OAuth Client Authentication
On the Remedy SSO Console, in the Redirect URI text box enter the following URL:
http://<Swagger Tomcat Host Name or IP address>:<Tomcat HTTP port>/swagger-ui/oauth2-redirect.html
The default port is 8080.- Click Save.
Copy the ClientSecret shown in the pop-up.
To configure OAuth authentication in the Swagger UI
- Add the following attribute in the index.html file, located in the swagger-ui folder.
oauth2RedirectUrl: window.location.origin +"/swagger-ui/oauth2-redirect.html" Replace the url attribute below the SwaggerUIBundle with the following URL details.
The default Jetty Server port is 8008.urls: [{url:"http://<AR Server IP address>:<Jetty Server port>/api/arsys/v1.0/swagger/ars-jwt.json",name:"JWTResource"},
{url:"http://<AR Server IP address>:<c>/api/arsys/v1.0/swagger/ars-entry.json?rssoUrl=
http://<rsso server ip>:<RSSO Jetty Server port>",name:"EntryResource"},
{url:"http://<AR Server IP address>:<Jetty Server port>/api/arsys/v1.0/swagger/ars-fields.json?rssoUrl=
http://<rsso server ip>:<RSSO Jetty Server port>",name:"FieldsResource"}
{url:"http://<AR Server IP address>:<Jetty Server port>/api/arsys/v1.0/swagger/ars-Menu.json?rssoUrl=
http://<rsso server ip>:<RSSO Jetty Server port>",name:"MenuResource"}
{url:"http://<AR Server IP address>:<Jetty Server port>/api/arsys/v1.0/swagger/ars-Webhook.json?rssoUrl=
http://<rsso server ip>:<RSSO Jetty Server port>",name:"WebhookResource"}
],- Refresh the browser.
- Click Authorize.
The following pop-up is displayed. - Enter Client ID and ClientSecret for the client registered in your Remedy SSO admin console. Refer to the ClientSecret that you have saved.
- Click Authorize.
A new browser window opens. - Enter the AR System login credentials. Click Log in.
After successful authentication, the following screen is displayed. - Click OK. You are now authorised through OAuth2 authentication.
Related topics
Integrating-AR-System-forms-with-a-third-party-application-by-using-the-REST-API
Troubleshooting-issues-when-using-Swagger-as-a-Remedy-REST-API-clientSwagger RESTful API Documentation Specification