Creating APIs
Now that you have created your API, you can:
lac53
This article includes information about the approaches to creating APIs, how to create an API, how to view an overview of your API, and the steps you can take after you have created your API.
In this article:
Approaches to Creating APIs
The following diagram illustrates the approaches that you can use to create your API using
Layer7 Live API Creator
:.png/_jcr_content/renditions/original)
Whatever approach you use to create APIs, you can iterate quickly with
Layer7 Live API Creator
. You can receive immediate feedback from business users while continuing to refine application logic and develop custom client interfaces (applications). The APIs that you create using API Creator provide enterprise-pattern automation, including optimistic locking, pagination, and generated key support.For more information about how
Layer7 Live API Creator
delivers enterprise-class performance, see Performance.Create an API
- In API Creator, on the APIs page, clickCreate New API.The connection wizard opens. The following image shows the connection wizard:
- Click the approach that you want to use to create your API:If you are new to creating APIs using API Creator, we recommend that you create your API by connecting to the Northwind sample database (clickDatabase First, and then clickExample Northwind database).
- Database FirstWith theDatabase-firstapproach to creating APIs, create your API by connecting to an existing database. This approach creates a default API based on schema discovery. You can then extend your API.Prerequisite:You have the database server information and credentials required to connect to the database.In the connection wizard, connect to your database by selecting one of the following options, and then clickContinue:
- Example Northwind database.Click this option to connect your API to the Northwind sample database.
- Target database.Click the target database to which you want your API to connect. Then complete the following steps:
- Enter the required connection properties that the JDBC driver requires.For more information about the connection values for each target database that is listed in the connection wizard, including information about how to set up to connect to one of these data sources, see the following articles:The connection wizard displays the database drivers thatLayer7 Live API Creatorsupports.For more information about the supported drivers, see Installation Requirements and Supported Platforms.
- (Optional) To test your connection to your SQL database with the URL credentials, clickTest Connection. Your new API requires a successful database connection. API Creator reads the schema tables, views, procedures, keys, and relationships and connects the database to API Creator.If you are connecting to a Datacom data source, the JDBC driver for Datacom includes a limitation that prevents you from testing this data source connection.
- ClickContinue.
- Click one of the following:
- Proceed to API Properties.
- Proceed to API REST Lab.
If you clickedProceed to API Properties, the API Properties page appears.
- New empty database.This option creates an API for a managed database.Prerequisite:You have added a managed data server and it is active.For more information about how to add a managed data server, see Managed Data Server Administration.
- Empty API.This option creates an API without an initial database connection.
- JNDI data source.Select this option if your connection information is not stored in the admin repository or if you want greater flexibility in leveraging database management system (DBMS)-specific options, such as Secure Sockets Layer (SSL) access and mirroring.Firewalls require accommodations.For more information about the location of your admin repository, see View your API Definition.
A default API that matches your schema and a connection to the database are created. - App FirstWith theApp-firstapproach to creating APIs, you create an empty API, and then select the managed data server that you want to use and create your database. With this approach, you create your tables, fields, and data using Data Explorer.Layer7 Live API Creatorcreates your application, your schema, and your default API.Prerequisite:You have added a managed data server and it is active.A default API for this database is created, your data source for a managed database is added to the managed data server, and the data source is added to the list of API data sources. Data Explorer starts in Author Mode in another browser window. Create your tables, fields, and data using Data Explorer.If you are using the defaults, enteradminas your username andPassword1as your password.For more information:
- About how to add a data source for a managed data server while creating your API, see Managed Data Server Administration.
- About how to create your tables, fields, and data using Data Explorer, see Manage Tables in Managed Databases.
- Code FirstWith theCode-firstapproach to creating APIs, you create an empty API, and then you customize your API by defining RESTful endpoints, or resources, explicitly using API Creator, by creating functions, or by adding custom endpoints.A tile for your API is added to the APIs page, and is highlighted.For more information:
- About how to customize your API, see Customize your API.
- About how to create functions, see Manage Functions.
- About how to add custom endpoints, see Manage Custom Endpoints.
- Model FirstWith theModel-firstapproach to creating APIs, API Creator creates your data source for a managed database and your default API. You convert a data model, such as Swagger, to schema format and then create your schema and API by importing your data model (JSON file).Prerequisite:You have added a managed data server and it is active.A default API and its associated database are created.For more information:
- About how to create your API and your schema from a Swagger document, see Swagger to Schema.
- About how to add a managed data server, see Managed Data Server Administration.
Layer7 Live API Creatorcreates the metadata in the admin repository.
View an Overview of your API
The
Overview
tab on the API Properties page displays an overview of your API. To view this tab, in the Create section, click API Properties
. It is the default tab that displays.This tab summarizes the artifacts in your API, providing visibility to:
- Summary:The table provides a high-level view of what you have defined in your API. This is a good place to start if you are viewing an API that you imported for the first time in API Creator.Within the table, you can view the number of data source connections, API interface components (resources, functions, request events, and custom endpoints), rules, listener components (listeners, connections, and timers), and roles that you have defined for your API. From the summary, you can link to the page in API Creator from which you can add data source connections, resources, etc.
- Description of an artifact:Within the table, learn about an artifact by clicking the help icon.Move your cursor over the artifact in the table to view the icon.
- Advisories:The API Advisor displays advisories for various aspects of your API based on how you have defined an artifact in your API. For example, you can receive an advisory about features that you are not using, such as rules and resources. You can view your dismissed advisories by clicking the refresh icon.These advisories do not impact the performance or behavior of your API. You can dismiss them without action.
Search your API
You can search the artifacts and the content within the code in your API by clicking the Search your API (the magnifying glass) icon.
You can also activate a search using keyboard commands. (Windows) Press the
ALT + S
keys on your keyboard. (Mac/UNIX) Press the OPTION+S
keys on your keyboard.Watch the Video
For more information about how to create your default API, watch the following
Approaches to Creating APIs
video:Next Steps
Now that you have created your API, you can:
- (If you created your API using theDatabase-firstapproach to creating APIs and your entities use sequences) Associate your entities to sequences.For more information, see Associate Entities to Sequences.
- Define resources for your API.For more information about how to define resources, see Customize your API.
- Specify your business logic and security.For more information, see Logic.
- Enhance and extend system automation for update and retrieval logic with procedural code using server-side JavaScript.For more information, see Extensibility.
- Explore your data and create new databases using Data Explorer.For more information about how to use Data Explorer, see Data Explorer.