Latest JAS v1.1.0
144 plugins online

Core / API

JAS supports a number of different APIs for you to integrate with. For information on how to use the APIs in your PHP code please refer to the function reference.

The following API formats are available and  can be found in the APIs directory http://localhost/api/:

The endpoints below are available for all API formats and are typically used by providing the "request" parameter (e.g.
/api/yaml/?request=module: categories). Note that we're contemplating the use individual parameters however the "request" parameter will always remain supported. Lastly each API format has a "GUI" that can be open in a browser /api/xml/request.php can allows for easier request creation.

Data

By far the most relevant, elaborate and flexible endpoint is the "Data" objects end point. As the name implies it's effectively an entry point to the core data object and thus provides pretty much the same functionality.

Request all categories
YAML API
module: categories
action: view
extra: all
Response
YAML API
module: categories
action: view
extra: all
dataformat: html
db: default
title: Category
field:
  nr:
    properties: identifier;hidden;global;default
    value:
    - "1"
    - "45"
    - "199"
    - ....
vmax: 102
sortOrder:
  • ordernr+
  • name+


See the examples page for more example on how the Data endpoint is used in practice.

Language

The language endpoint allows you get translations defined in JAS. For example the WYSIWYG editor is automatically translated using this API.

Request modules translations
XML API
<?xml version="1.0" encoding="ISO-8859-1"?>
<jas version="1.0">
  <language set="modules" language="nl" />
</jas>
Response
XML API
<?xml version="1.0" encoding="ISO-8859-1"?>
<jas version="1.0">
  <language original="en" translated="nl" set="modules" updated="2015-01-14 21:19:56">
    <translation original="Module" translated="Module" />
    <translation original="Action" translated="Actie" />
    ...
  </language>
</jas>


Modules

The modules endpoint allows you to get... all modules. So if you want to check whether a specific module is available in the current project you request them and see if it's in the list.

Request modules
JSON API
{
    "type": "modules",
    "all": true
}
Response
JSON API
{
    "type": "modules",
    "modules": [
        "attempts",
        "cache",
        "categories",
        ...
    ]
}


Ok so you know what modules are available but what are they really? To get the full definition of a module simply add the list of modules you'd like to request.

Request a module definition
JSON API
{
    "type": "modules",
    "modules": [
        "categories"
    ]
}
Response
JSON API
{
    "type": "modules",
    "modules": [
        {
            "action": "view",
            "extra": "item",
            "dataformat": "html",
            "db": "default",
            "title": "Category",
            "field": {
                "nr": {
                    "properties": "identifier;hidden;global;default",
                    "operant": [
                        "AND"
                    ],
                    "mutilation": [],
                    "use": "sql;form",
                    "value": [
                        0
                    ],
                    "valuetype": "none",
                    "operator": []
                },
                "name": {
                    "properties": "title",
                    "operant": [
                        "AND"
                    ],
                    "mutilation": [],
                    "use": "form;sql;show",
                    "value": [
                        ""
                    ],
                    "valuetype": "none",
                    "operator": []
                },
                ....
            },
            "reference": {
                "catnr": {
                    "from": "catnr",
                    "module": "categories",
                    "to": "nr",
                    "type": "*:1"
                },
                "owner": {
                    "from": "owner",
                    "module": "users",
                    "to": "nr",
                    "type": "*:1"
                }
            },
            "module": "categories",
            "vmax": 1,
            "sortOrder": [
                "ordernr+",
                "name+"
            ],
        }
    ]
}


Projects

It's also possible to get the list of available JAS projects and even switch to another project.

Request projects
CSV API
projects
Response
CSV API
"projects";"current"
"jas";""
"test";"true"
"website";""


To switch simply set the project you'd like to switch to. Do note the newly selected project can have a different API configuration and thus (dis)allow you certain things that were (not) allowed in the other project.
Switch to another project
CSV API
projects;website
Response
CSV API
"projects";"current"
"jas";""
"test";""
"website";"true"


Errors

Of course it's possible to fail miserably in which case you'll get an error response.

Request modules on a disabled API
YAML API
type: modules
Error response
YAML API
errors: 1
error:
  • YAML API is disabled
extra:
  • false
errorlevel:
  • 3

Comments (0)