API Docs

API Docs
You can create client code (SDKs) to make RESTful data easy to consume in your application (for example, Java Plain Old Java Objects (POJOs) or .NET Plain Old CLR Objects (POCOs)) using Swagger-based tools. You can document your API using the Swagger service that 
CA Live API Creator
 includes. In addition to API documentation, the Swagger service drives several tools in the Swagger ecosystem, such as generation of client SDKs.
For more information about Swagger, see the Swagger site.
In this article:
Access Swagger
You can access Swagger in API Creator from the following locations in API Creator:
  • The REST Lab
    In the Execute section, click 
    REST Lab
    . Use the 
    metadata endpoint.
    For more information about how to retrieve a Swagger document about your API using this RESTful endpoint, see System REST Endpoints.
  • The API Docs page.
    In the Execute section, click
    API Docs
    , and then click the 
    API Documentation
On the
API Documentation
tab, Swagger starts by showing a list of APIs. These are your database objects (tables, views, and stored procedures) and the resources you defined explicitly in API Creator. You can expand the list to list the operations. You can further expand the operations to see the JSON details, as shown in the following image of the API Documentation page:
The Swagger specification for your API is available at the URL that is specified in the URL box near the Swagger logo. You can use it, possibly with the API key on the URL, for example:
The generated Swagger document reflects the endpoints to which the
API Documentation
role has access. If you do not want your API to be reflected in the Swagger document, change the
API Documentation
role to include or exclude the parts of your API from that role.
For more information about how to authorize role access to REST endpoints, see Authorization and Role-Based Endpoint Access.
View the References for your API
You can use the references for your API that API Creator provides on the 
 tab. To access this tab, from the Execute section, click 
API Docs
. You can also access the code samples that are displayed on the 
Code samples
For example, RESTful calls require an authentication token. You can view this requirement on the 
 tab, as shown in the following image:
Swagger's popularity has resulted in a rich ecosystem of tools built around Swagger. For example, you can generate client-side SDKs for your API using swagger-codegen, which can generate client-side APIs for Java, C#, Scala, Clojure, Dart, Go, Objective-C, Perl, Python, PHP, Ruby, and more.
For example, you can use a swagger-codegen-generated API, in this case for Java:
AllCustomersApi allCusts = new AllCustomersApi();
      // Set up the API client (only needs to be done once)
ApiClient client = allCusts.getApiClient();
client.addDefaultHeader("Authorization", "CALiveAPICreator demo_full:1");
client.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"));
      // Get all the customers
List<AllCustomers> custs = allCusts.allCustomersGet(null, null, null, null, null, null,
               null, null, null, null, null, null, null, null, null, null);
for (AllCustomers cust : custs) {
System.out.println("Customer: " + cust.getName());
For more information:
Retrieve Swagger Documentation for your API
Your API includes endpoints for Swagger generation. You can retireve the Swagger documentation for your API or you can get details about a specific endpoint.
You can also retrieve a Swagger document about an API using the 
 RESTful endpoint.
For more information about how to use this system RESTful endpoint, see System REST Endpoints.
  1. With your API open, in the Execute section, click
    REST Lab
  2. Complete the following and then send your request by clicking
    1. Select
      as the endpoint on which you want to operate.
    2. Select 
       as the metadata call.
    For example, to get the Swagger documentation for your API:
The JSON response appears in the
section of the page.
Call Swagger in a Browser
You can access the Swagger documentation directly from a browser.
 You have enabled access to Swagger documentation without authentication.
For more information about how to enable access to Swagger documentation without authentication, see API Properties.
Connect to your API
You can get the details on how to connect to your API, including examples, using the Swagger API doc in API Creator.
With your API open, in the Execute section, click the 
API Docs
Get Code Samples
You can get help connecting and returning your REST APIs and view the sample code fragments.
  1. With your API open, in the Execute section, click 
    API Docs
     tab displays by default.
  2. Click the 
    Code samples