Docs‎ > ‎

Logic Administration

When you use the Logic Designer, you may not realize that you are using an Espresso Logic client: all the information that you manipulate, such as projects, API keys, rules, etc... are stored in a relational database, and manipulated via an Espresso Logic REST API.

This means that you can programmatically do anything that the Logic Designer can do.

The following shows a few examples of using this API.

All examples assume, of course, that you are sending an API key along with the request, either in the URL (with the auth parameter) or (more commonly) in the Authorization header.


@tables

In addition, the API key in question must have access to the resource in question. For instance, if you want to get the list of all tables for a project, your API key must have a role with a permission for the @tables pseudo-table.

Example: retrieve a list of all tables in a project.

URL:
https://eval.espressologic.com/rest/acme/myproject/v1/@tables

You can use the href URL to retrieve full information for a table, or "*" for full information for all table information (see screen shot, below).

Response:
[
  {
    "@metadata": {
        "href": "https://eval.espressologic.com/rest/acme/myproject/v1/@tables/customer"
    },
    "name": "customer"
  },
  {
    "@metadata": {
        "href": "https://eval.espressologic.com/rest/acme/myproject/v1/@tables/lineitem"
    },
    "name": "lineitem"
  },
  {
    "@metadata": {
        "href": "https://eval.espressologic.com/rest/acme/myproject/v1/@tables/product"
    },
    "name": "product"
  },
  {
    "@metadata": {
        "href": "https://eval.espressologic.com/rest/acme/myproject/v1/@tables/purchaseorder"
    },
    "name": "purchaseorder"
  }
]

You can then follow one of the href links, such as https://eval.espressologic.com/rest/acme/myproject/v1/@tables/lineitem

{
  "@metadata": {
    "href": "https://eval.espressologic.com/rest/acme/myproject/v1/@tables/lineitem"
  },
  "name": "lineitem",
  "primaryKey": {
    "columns": [
      {
        "name": "lineitem_id",
        "type": "BIGINT"
      }
    ]
  },
  "columns": [
    {
      "name": "lineitem_id",
      "type": "BIGINT",
      "size": 19,
      "nullable": false
    },
    {
      "name": "product_number",
      "type": "BIGINT",
      "size": 19,
      "nullable": false
    },
    {
      "name": "order_number",
      "type": "BIGINT",
      "size": 19,
      "nullable": false
    },
    {
      "name": "qty_ordered",
      "type": "INTEGER",
      "size": 10,
      "nullable": false
    },
    {
      "name": "product_price",
      "type": "DECIMAL",
      "size": 19,
      "nullable": true
    },
    {
      "name": "amount",
      "type": "DECIMAL",
      "size": 19,
      "nullable": true
    }
  ],
  "parents": [
    {
      "name": "product",
      "parent_table": "product",
      "parent_columns": [
        "product_number"
      ],
      "child_columns": [
        "product_number"
      ]
    },
    {
      "name": "lineitem_purchaseorder",
      "parent_table": "purchaseorder",
      "parent_columns": [
        "order_number"
      ],
      "child_columns": [
        "order_number"
      ]
    }
  ],
  "keys": [
    {
      "name": "PRIMARY",
      "type": "primary",
      "columns": "lineitem_id"
    }
  ]
}

You can test Admin APIs in the RESTlab:




@resources

The system provides similar built-in resources for resources, such as

http://houston.d.espressologic.com/rest/abl/demo/v1/@resources


@authentication

A RESTful end point is provided to authenticate a user and obtain an APIKey.


@procedures

metadata about stored procedures is available with a GET to a URL in the form:



You will get a response that looks like:

[

  {

    "@metadata": {

      "href": "https://espresso.acme.com/rest/acme/admin/v2/@procedures/demo:get_employee?projectId=1234"

    },

    "prefix": "demo",

    "entity": "get_employee",

    "name": "demo:get_employee"

  },

  {

    "@metadata": {

      "href": "https://espresso.acme.com/rest/acme/admin/v2/@procedures/demo:promote_employee?projectId=1234"

    },

    "prefix": "demo",

    "entity": "promote_employee",

    "name": "demo:promote_employee"

  }

]



You can then get full information on a procedure by doing a GET against that procedure's URL, which will give you something like:

{

  "@metadata": {

    "href": "https://espresso.acme.com/rest/acme/admin/v2/@procedures/demo:get_employee?projectId=1234"

  },

  "prefix": "demo",

  "entity": "get_employee",

  "name": "demo:get_employee",

  "args": [

    {

      "name": "given_employee_id",

      "type": "BIGINT",

      "direction": "IN"

    },

    {

      "name": "plus_one",

      "type": "BIGINT",

      "direction": "IN_OUT"

    }

  ]

}



@sequences



@perf

Basic statistics

@serverinfo

Provides server id

@catalogs

Database catalogs

@fks

Custom-defined foreign keys (defined in Espresso Designer)