Customize your API

You can customize and shape your API by defining RESTful endpoints, or resources, explicitly using API Creator, by creating functions, or by adding custom endpoints. This article focuses on the resources that you can define explicitly using API Creator.
lac52
You can customize and shape your API by defining RESTful endpoints, or resources, explicitly using API Creator, by creating functions, or by adding custom endpoints. This article focuses on the resources that you can define explicitly using API Creator.
For more information:
Use the following table to guide you on which endpoint type to define for your API:
Task
Table-based Resources
JavaScript Resources
Free SQL Resources
Functions
Custom Endpoints
Can include JavaScript code
Yes
Yes
No
Yes
Yes
Can include subresources
Yes
No
No
No
No
Can include non-persistent attributes (NPAs)
Yes
No
No
No
No
Can include GET events
Yes
No
Yes
N/A
N/A
Can include POST/PUT events
Yes
No
No
N/A
N/A
Are data-oriented
Yes
Yes
, as defined in the code
Yes
Yes
No
Provide a database abstraction layer
Yes
Yes
, as defined in the code
Yes
No
No
Response formats
JSON and XML
JSON and XML
JSON, HTML, and XML
JSON and XML
JSON, HTML, and XML
Are associated to entities (tables or views) or table-based resources
Yes
No
No
Optionally
No
Custom endpoints can invoke entities and resources.
For more information, see Manage Custom Endpoints.
Have input parameters
No
No
Yes
Yes
No
Can be called using HTTP methods
GET, POST, PUT, and DELETE
GET and POST
GET
GET and POST
GET, POST, PUT, and DELETE
Are included in OpenAPI (Swagger) documentation
Yes
Yes
Yes
Yes
No
Are authenticated
Yes
Yes
Yes
Yes
Optionally
In this article:
2
Sources for Resources
Your API can consist of the schema resources and the resources that you define explicitly in your API using API Creator. Schema resources are the tables, views, and stored procedures that 
Layer7 Live API Creator
 exposes when you create your API and connect to a database.
Layer7 Live API Creator
 creates these schema resources by scanning the schema for the table-based resources, views, and stored procedures. You can begin client development in parallel with logic development using the schema resources.
Insulate your database and reduce latency instead of exposing your database or rewriting existing logic. Migrate your schema resources as resources that you define explicitly in API Creator, and then define your logic and security.
You can define explicitly the following types of resources in your API:
The resources that you define explicitly provide a data abstraction layer, where you can choose and alias the data that you want to present. These resources are loosely akin to database views, where you can define named projections, filters, and alias names. They drive the mapping process.
Layer7 Live API Creator
 transforms resource rows to table rows for business-logic processing and persistence.
When you create an API and you connect to your database, 
Layer7 Live API Creator
 also creates (not code generation) the JavaScript object model, made available through the 
row
 object that it passes into your logic. This object model reads and writes data by addressing attribute/object accessors and persistence services.
For more information about the JavaScript object model and how 
Layer7 Live API Creator
 creates row objects for your base tables, see Row Objects.
View your List of Resources
The resources that you can define explicitly in your API are displayed in the list of resources, on the Resources page. To view this page, with your API open, in the Create section, click 
Resources
.
Identify the Resource Type
You can identify the resource type for these resources using the icons that display to the left of the resource name in the list of resources:
Icon
Description
The resource is table-based resource.
The resource is Free SQL resource.
The resource is JavaScript resource.
The resource includes row events.
Test Resources
You can test your resource in the REST Lab.
Follow these steps:
  1. Open the API containing the resource that you want to test.
  2. In the Create section, click 
    Resources
    .
    The Resource page appears.
  3. Select the resource that you want to test from the list of resources, and then click 
    Test
    .
The REST Lab opens.
You can return to the Resources page from the REST Lab by clicking
Edit
.