Docs‎ > ‎Live API Creator Overview‎ > ‎

API Docs

Swagger

You can use Swagger-based tools to create client code (SDKs) to make RESTful data easy to consume in your application (e.g., Java POJOs, or .NET POCOs). You can document your API using the built-in Swagger service. Besides API Documentation, this drives several tools in the Swagger ecosystem, such as generation of client sdks.

For more information about Swagger, see the Swagger site.

Access Swagger from the REST Lab or from the Execute > API Docs > API documentation tab.

Behavior too

Also, note you can document the behavior of your API, using Topics.
Swagger starts by showing a list of APIs. In API Creator, these are your database objects (tables, views and stored procedures) and your Custom Resources.
  1. Click Quick Ref (left nav bar).
  2. Click the API Documentation tab
  3. Click View Documentation
You can expand the list to list the operations. You can further expand the operations to see the JSON details (expand the thumbnail).


The Swagger specification for your API Creator project is available at the URL specified in the URL box near the Swagger logo. You can use it (possibly with the API key on the URL, e.g. .../@docs/Customers?auth=MyApiKey:1)

REST APIs

Swagger's popularity has resulted in a rich ecosystem of tools built around Swagger. These are available for your API Server.
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.

A possible example for using 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.setBasePath("https://rest.acme.com/rest/default/demo/v1");
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());
}

Call Swagger in a Browser

You can call the Swagger UI using the Swagger service and passing in the project URL. To allow Swagger to be called without an auth token, you must select the Allow Swagger without authentication checkbox API property.

http://localhost:8080/APICreator/swagger-ui/index.html?url=http://localhost:8080/rest/default/demo/v1/%40docs

API Documentation Services

Your API includes endpoints for Swagger generation:

  • Get details on a specific endpoint using @docs/customers, as shown here.

Connect to your API

To get the details on how to connect to your API, select API Docs > Connecting. This page also gives examples.

Get Code Samples

To get help connecting and returning your REST APIs and to view the sample code fragments, select API Docs > Code samples.