API Creation Endpoints

API Creation Endpoints
lac52
You can script the creation of an API using the endpoints and attributes that the 
Layer7 Live API Creator
 Admin API (Admin API) provides.
 The 
ident
 and 
ts
 attributes are present in all cases except where noted. Required attributes are in 
bold
. The attributes that 
Layer7 Live API Creator
 does not use are in ita
lics
. Some endpoints, such as 
rules
 and 
resources
, are non-obvious. To give you guidance, we recommend that you create these endpoints using API Creator and then look at them in the API.
For more information:
For more information about how script the creation of an API, see Import and Export APIs.
Endpoint
Description
Attributes
accounts
The TeamSpace of which your API is a part.
For more information about how to manage TeamSpaces using this endpoint, see The accounts Endpoint.
"
name
": "default account",
"
url_name
": "default",
"
status
": "A",
"
public_key
": null,
"
private_key
": null
apikeyroles
The connection between auth tokens and roles.
"apikey_ident": 2142,
"role_ident": 2052
apikeys
The authentication tokens for an API.
For more information about this endpoint, see The apikeys Endpoint.
"
name
": "Bob's key",
"description": "Auth token for Bob",
"
apikey
": "UED8gvCScR0ahxGQ1d9N",
"
status
": "A",
"expiration": "2015-11-26T21:27:44.709Z",
"logging": "*=DEBUG",
"user_identifier": "bob",
"data": "username=bob",
"origin": "A",
"
project_ident
": 2022
apiversions
The API versions.
For more information about this endpoint, see The apiversion Endpoint.
"
name
": "v1",
"comments": "Version 1 of my API",
"
project_ident
": 2022
authproviders
The authentication providers. 
"
name
": "New Provider oavbn",
"comments": null,
"
auth_type_ident
": 1,
"
class_name
": "com.kahuna.server.auth.db.DefaultAuthProvider",
"bootstrap_config_value": null,
"param_map": null,
"get_config_info_code": null,
"configure_code": null,
"get_login_info_code": null,
"auth_code": null,
"
account_ident
": 1000
dbaseschemas
The connection to the database. 
"
conn_type
": null,
"
prefix
": "nw",
"
name
": "Database: Derby - Northwind",
"comments": "Northwind db",
"datasource_name": null,
"
url
": "jdbc:derby:Northwind",
"catalog_name": null,
"schema_name": null,
"user_name": "Northwind",
"password": "2:nZkkWa3wn1n7ORL...l1g==",
"salt": "ei2Eh8Pq/d62gq...1u2CV1",
"port_num": null,
"read_only": null,
"schema_editable": null,
"admin_url": null,
"
active
": true,
"status": null,
"
project_ident
": 2022,
"
dbasetype_ident
": 17
dbasetypes
The data source types to which you can connect your API.
For more information about the 
dbasetypes
 endpoint, see The dbasetypes Endpoint.
"
name
": "MySQL",
"description": "MySQL Database",
"version_name": "All versions",
"
driver_class_name_list
": "com.mysql.jdbc.Driver",
"catalog_term": "Database",
"schema_term": null,
"url_prototype": "jdbc:mysql://<host>:<port>/<db>",
"
driver_help
": null,
"enabled": true,
"managed_data_capable": true
eventhandlers
The resource event handlers.
"
name
": "Inject metadata action tags",
"description": null,
"
code
": "if etc...\n",
"
active
": true,
"enabled_verbs": null,
"resource_name_pattern": null,
"
eventtype_ident
": 1,
"code_type": null,
"
project_ident
": 2025
gateways
The CA API Gateway integration endpoint.
"name": "CA API Gateway Development Server",
"default_username": "test",
"url": "http://someserver:8657",
"comments": "test",
"account_ident": 1,
"is_active": true
handlers
The custom endpoints.
For more information about custom endpoints, see Manage Custom Endpoints.
"
name
": "My custom endpoint",
"
active
": true,
"
url_pattern
": "special/.*",
"
verbs
": "GET,",
"
code
": "if etc...\n",
"comments": null,
"
project_ident
": 2033
managed_data_servers
Defines a connection url for managed databases (creating databases, creating tables, adding fields, and creating relationships).
For more information about managed databases, see Database Creation.
"
name
": "testing_postgres",
"comments": "this is a postgresql comment",
"datasource_name": null,
"url": "jdbc:postgresql://192.168.99.100:5432/postgres",
"catalog_name": null,
"
user_name
": "postgres",
"
password
": "password1",
"
is_active
": true,
"
dbasetype_ident
": 8,
"
account_ident
": 1000
named_filters
Named filters, created to handle complex queries without risking a SQL injection.
For more information about named filters, see Structured Filters.
"
name
": "My filter",
"description": "Yadda yadda",
"
resource_names
": "customers",
"
filter_text
": "balance < {bal}",
"
project_ident
": 2033
named_sorts
Named sorts, created to provide complex sorting without risking a SQL injection.
For more information about named sorts, see Structured Sorts.
"
name
": "My sort",
"description": "Desc here",
"
resource_names
": "customers",
"
sort_text
": "round(balance)",
"
project_ident
": 2033
permissiondata
The additional data that is attached to roles.
For more information about how to set permissions for roles, see Authorization and Role-Based Endpoint Access.
"
name
": "Data",
"description": "Employee number",
"
prefix
": "cust",
"
query
": "select empno from etc...",
"query_order": 1,
"required": true,
"
code_type
": "SQL",
"
role_ident
": 2075
projectoptions
The options for an API.
"
option_value
": "20",
"
project_ident
": 2022,
"
projectoptiontype_ident
": 7
projectoptiontypes
The possible types of options.
You cannot alter these types.
"
name
": "HTTPS only",
"
data_type
": "boolean",
"description": "Yadda yadda.",
"default_value": "false",
"valid_values": null,
"
system_only
": false
projects
The API.
"
name
": "Northwind",
"
url_name
": "nw",
"comments": "Simple order processing demo",
"status": null,
"
is_active
": true,
"
account_ident
": 1000,
"
authprovider_ident
": 1000
relationships
The associations between child entity (table or view) and its parent entity (potentially in different databases).
For more information about relationships, see Database Relationships.
"
name
": "Between customers and orders", "
parent_entity_name
": "cust:customers", "
child_entity_name
": "cust:orders", "
role_to_child
": "orders", "
role_to_parent
": "customer", "
parent_columns
": "cust_no", "
child_columns
": "customer_no", "
update_rule
": "R", "
delete_rule
": "R", "comments": "Yadda", "
project_ident
": 2033
resource_types
The types of resources.
You cannot change the resource types.
"
ident
": 1,
"
description
": "Table-based resource"
resourceattributes
An attribute in a table-based resource (resource attribute). By default, resources use the columns from the entity (table or view) and return all base entity columns.
For more information about resource attributes, see Manage Resource Attributes.
"
name
": "ID",
"description": null,
"
column_name
": "CustomerID",
"json_type": null,
"roles_to_ancestor": null,
"is_defined_key_part": false,
"is_lookup_key_part": false,
"is_hidden_virtual": false,
"sibling_rank": 100,
"
resource_ident
": 2070
 
roles_to_ancestor
 : Used to do parent lookups.
 
is_lookup_key_part
 : If set to 
true
 , then this lookup is used in a PUT/POST event. 
Virtual resource attributes use the following endpoint attributes:
  •  
    json_type
     
  •  
    column_name
    : For virtual resource attributes, the value is 
    null
     .
  •  
    is_hidden_virtual
     :
    •  
      true
       : The virtual attribute is not displayed in the JSON response.
    •  
      false
       : The virtual attribute is displayed in the JSON response.
    Default:
     
    false
     
resources
A resource that can be part of a resource tree.
"
resource_type_ident
": 1,
"
prefix
": "nw",
"
table_name
": "Customers",
"
name
": "CustomersWithOrders",
"description": "Customers with orders",
"is_collection": "Y",
"join_condition": null,
"filter": null,
"sorting": "\"CompanyName\" asc",
"code_text": null,
"event_get_code": null,
"event_put_post_code": null,
"filter_code": null,
"serial_filter": null,
"prop1": null,
"prop2": null,
"prop3": null,
"prop4": null,
"prop5": null,
"container_ident": null,
"sibling_rank": 100,
"extended_properties_json": null,
"combined": false,
"
apiversion_ident
": 2022
roles
The security roles that are defined as part of an API.
"
name
": "Full access",
"description": "Full access to this API",
"
default_permission
": "A",
"
default_apivisibility
": "TVPRM",
"
project_ident
": 2022
rules
The business logic for an API.
"
entity_name
": "nw:Customers",
"attribute_name": null,
"prop1": null,
"prop2": null,
"prop3": null,
"prop4": "javascript",
"prop5": null,
"rule_text1": "return etc...;",
"rule_text2": "Transaction cannot be etc...",
"rule_text3": null,
"rule_text4": null,
"rule_text5": null,
"predicate": null,
"name": "",
"auto_name": "Validation etc...",
"verbs": null,
"comments": "Yadda yadda",
"
active
": true,
"
project_ident
": 2022,
"
ruletype_ident
": 5
ruletypes
The types of rules.
You cannot change the rule types.
"
name
": "sum",
"method": null,
"template": "Derive etc...",
"short_desc": "sum child attr into parent",
"description_url": null,
"
ruleexecutiontype_ident
": 1,
"isCore": null
tablepermissions
The permissions for a role's table.
"
name
": "My Regions Customer",
"description": "Yadda yadda",
"
entity_name
": "nw:Customers",
"column_names": null,
"predicate": "\"Region\" = '@{UserRegion}'",
"
access_type
": "A",
"
role_ident
": 2054
topics
The topics for rules.
"
name
": "Customer creation",
"color": "#a4fcc6",
"summary": "Yadda yadda",
"description": "HTML code here",
"
project_ident
": 2031
users
The API users for the built-in authentication provider.
"
name
": "bob",
"fullname": "Bob Newhart",
"email": "[email protected]",
"
status
": "A",
"
roles
": "Customer rep,",
"data": "empId=1234",
"comments": "Yadda",
"apikey_lifespan": null,
"password_hash": "thCQL0ADu2...ZQ==",
"password_salt": "MSUVe...BmCqQ==",
"
project_ident
": 3