Tutorials and Samples

View sample APIs to expedite your learning.
lac52
You can expedite your learning using the sample APIs that 
Layer7 Live API Creator
 includes. Some 
Layer7 Live API Creator
 installations, such as the single-user demonstration package of 
Layer7 Live API Creator
 that is based on Jetty (demonstration package), include samples.
 
Layer7 Live API Creator
 includes the following sample APIs:
You can view more sample APIs in GitHub.
Sample API Name
Functional Summary
Conference Offers and Conference Management
These sample APIs illustrate accepting events with exhibitions and talk options, gathering responses, and enforcing budget. They illustrate a complete system from a standing start, including an autonomous service for message processing. These samples create a database, a user interface (UI), and an API with logic.
For more information about these samples, including how to load them, see Conference Offers and Management API Samples.
B2B Pavlov and B2B Northwind
These sample APIs are an extension of the Northwind sample API and integrate with Partners, Suppliers, and multiple databases. They illustrate integration concepts and scripted API creation.
For more information about these sample APIs, see B2B API Sample.
Demo
This sample API illustrates basic 
Layer7 Live API Creator
 concepts. It also illustrates rules on the smallest database we believe is worth exploring. The Demo database is included with the Demo API.
For more information:
MQTT
This sample API illustrates how you can:
  • Set up a connection to an MQTT broker.
  • Set up an MQTT listener to subscribe to messages for a topic.
  • Publish MQTT messages from a function or timer. 
For more information about this API sample, including how to load it, see MQTT API Sample.
Kafka
This sample API illustrates how you can:
  • Set up a connection to a Kafka broker.
  • Set up a KafkaConsumer connection and listener to consume messages.
  • Publish a message using a KafkaProducer connection type from a function or timer.
For more information about this API sample, including how to load it, see MQTT API Sample.
RabbitMQ
This sample API illustrates how you can:
  • Set up a connection to a RabbitMQ broker.
  • Set up a RabbitMQ listener to subscribe to messages for a topic.
  • Publish RabbitMQ messages from a function.
For more information about this API sample, including how to load it, see RabbitMQ API Sample.
JMS
This sample API illustrates how you can:
  • Set up a connection to a Java Message Service (JMS) broker.
  • Set up a JMS listener to subscribe to messages for a JMS topic in a publish/subscribe messaging domain.
  • Set up a JMS listener to subscribe to messages from a JMS queue in the point-to-point messaging domain.
  • Publish JMS messages from a function.
For more information about this sample API, including how to load it, see JMS API Sample.
db2i
This sample API illustrates how you can:
  • Publish and subscribe to messages from data queues residing on Db2 for i databases using Db2iDataQueue listeners.
  • Expose API endpoints that call RPG programs.
  • Connect to Db2 for i databases and expose tables, views, stored procedures, and physical and logical files as REST endpoints.
For more information about this sample API, see the db2i API Sample documentation on GitHub.
Banking Demo
This sample API illustrates a funds transfer application, demonstrating how balances are automatically computed in two bank accounts. It illustrates a small system requiring only a few dozen lines of code.
For more information about this sample API, including how to load it, see Banking Demo API Sample.
Tasks
This sample API captures task breakdowns, their assignments to people, sprints and releases, with controls for balancing and time posting. It illustrates a complex system, and useful for your APIs, built in about a day, yet providing meaningful functionality.
For more information about this sample API, including how to load it, see Tasks API Sample.
Oracle Sequence Example
This sample API illustrates a technical sample, such as generating keys and database sequences. This sample API generates primary keys using JDBC connections.
For more information about this sample API, including how to load it, see Oracle Sequence Example API Sample.
Document Manager
This sample API is a small document manager that can store PDFs in binary fields and can display them in the browser by way of Data Explorer.
This API illustrates:
  • Non-persistent attributes
  • Formulas
  • Custom endpoints
  • Accessing binary data
For more information about this sample API, including how to load it, see Document Manager API Sample.
Northwind (database)
This database illustrates a few simple rules on the well-known Northwind reference database. Create a Northwind API sample by connecting to the Northwind database.
For more information:
Sample
This API sample illustrates advanced rules and database concepts. It consists of an order entry, departments database of few dozen tables, with complex logic and relationships. The Sample database is included with the Sample API. This database is used in the reactive logic tutorial, which is a complex example that illustrates a recursive deep copy, using reactive logic.
For more information:
MultiThreadedDemo
This API sample illustrates how to call multiple REST endpoints from API Creator using the Java Concurrent Executors framework. Using this framework, 
Layer7 Live API Creator
 can execute multiple requests in parallel, thus improving the response time of the combined API.
This API sample uses a custom endpoint and functions.
For more information about this API sample, see the MultiThreadedDemo page on GitHub.
Approximate Keys
This sample API illustrates a simple example and explores the approaches that you can use to address the issue of joining tables that have approximate keys.
For more information about this sample API, including how to load it, see Approximate Keys API Sample.
Demo and Sample Database
If you have installed 
Layer7 Live API Creator
 on a Java container as an installable web application ARchive (WAR), you must create the Demo and Sample databases and API. If you have installed the demonstration package, the Demo and Sample databases are included, and no additional steps are required to load the Demo and Sample APIs.
You can tell which version of 
Layer7 Live API Creator
 you are running by the URL. If you have installed the demonstration package, the URL looks similar to 
http://localhost:8080/APICreator/index.html
. If you have installed 
Layer7 Live API Creator
 on a Java container, the URL looks similar to 
http://localhost:8080/APIServer/APICreator/index.html
.
Create and Verify the Demo and Sample Database
You can verify the Sample database in your favorite database tools. You can use similar load procedures for your own APIs.
For more information:
Follow these steps:
 
  1. Export and unpack the API export file. The Demo and Sample databases contain the following files:
    • The 
      .JSON
       export file for each API. Export files are created when you export your API.For more information about how to export APIs, see Import and Export APIs.
    • SQL files. Use these files to initialize the schema and data.
  2. Create the 
    dblocal_demo
     and 
    dblocal_sample
     schemas.
  3. Load the schema and sample data from the 
    .sql
     file.
  4. (Optional) In MySQL Worbench, verify that the database is created by querying the 
    customer
     table. The following image shows the query in MySQL Workbench:
     
The Demo and Sample databases are created.
Create the Sample APIs
The sample APIs are available as 
.JSON
 file downloads. Create the sample APIs by importing them.
Complete this procedure once for the 
Sample
 API and once (as required) for the 
Demo
 sample API.
Prerequisite: 
You have exported and unpacked the API export file.
Follow these steps:
 
  1. Create an API by importing the unpacked 
    .JSON
     file.
    For more information about how to import API definitions, see Import and Export APIs.
  2. Fix the imported API by re-supplying the security information that was not included in the 
    .JSON
     export file.
    For more information about how to fix imported APIs, see Import and Export APIs.
The sample APIs are created.
Verify the Sample APIs
Ensure that your tables, views, and resources are working by verifying your sample APIs. Use the REST Lab or Data Explorer.
For more information: