Executes a Hublify API-call on the local system.

This is the same "api-style" as calling the Hublify-API from external systems.

Use this especially for CREATE, UPDATE and DELETE dataset-queries!


Syntax

api(string $resource, array $params = null): mixed

Parameter

  • $resource string
    The api resource-label to execute.

  • $params array|null
    Optional resource-parameters

Return

Returns the direct result of the called resource-function.

Most often this is an associative array / object of the following structure.
Of course the exact result-structure and -data can completely different for each api-resource called! ... BUT ! we gave our best to make it most possible harmonized! :)

{
    status: true,        // Typically, TRUE on success, else FALSE
    data: [ ... ],       // Most often an (associative) array, carrying the main results.
    meta: [ ... ],       // Sometimes an associative array, carrying side-infos (e.g. on CREATE or UPDATE calls)
    msg: [ {...}, ...]   // Numerical array of message-object(s)
}


Examples


{# Execute a "person_get" API-Call with a filter-param #}

{% set result = hublify.api( 'person_get', { "filter": { "persid": 123456 } }) %}