Maple Engine
Last Updated: 2023-11-04 06:02:43
An API endpoint is a URL path pointing to the dataset you want access. This endpoint is defined without a protocol or host name and always starts with /api followed by an optional plugin path. For example, /api/blog
Api is defined as { api [ ENDPOINT ] as [ VARIABLE ] }. Accessing a template API endpoint is written as follows.
{ api /path/to/endpoint as myList }
Read more about the Template Api for examples.
The resources statement is a combination of API calls and includes. It allows you to load pre-defined datasets without the use of URLs and offers more flexibility. The syntax was created to not only load a dataset but also import a template alongside it.
Resources can also accept one parameter and assign it's returned dataset to a variable much like the API syntax. There are three components to a resource which are the template, resource type, parameter and variable. Since templates and variables have been discussed and follow the same rules, we'll focus on the type and parameter aspect.
A resource type can be thought of as a group meaning when asking for a resource, you are first requesting the group followed by any specific forms of that resource. Types are alphabetic characters and do not contain numbers or other characters. They also must be in lowercase. There are currently two types available.
Navigation
Currency
A resource is defined as { resource [ TEMPLATE ] [ TYPE ] [ PARAMETER ] [ VARIABLE ] }. To load a template with a dataset resource is written as follows.
Example using NOPARAM
Resources can also accept one parameter and assign it's returned dataset to a variable much like the API syntax. There are three components to a resource which are the template, resource type, parameter and variable. Since templates and variables have been discussed and follow the same rules, we'll focus on the type and parameter aspect.
A resource type can be thought of as a group meaning when asking for a resource, you are first requesting the group followed by any specific forms of that resource. Types are alphabetic characters and do not contain numbers or other characters. They also must be in lowercase. There are currently two types available.
Navigation
Access datasets related to your navigation plugins' menu strips as defined in your administrative portal. A parameter is required and refers to a navigation strip reference title.
Currency
Access datasets related to your systems currency such as rates. The resource does not accept a parameter, however, parameter is a required field of the syntax. A resource must define a parameter, use a voided parameter like NOPARAM in-place of the parameter name.
Note: Currency rates are updated once daily and only contain a subset of the worlds currencies.
A resource is defined as { resource [ TEMPLATE ] [ TYPE ] [ PARAMETER ] [ VARIABLE ] }. To load a template with a dataset resource is written as follows.
{ resource /partials/mymenu.maple navigation HEADER myMenu }
Example using NOPARAM
{ resource /partials/mycurrency.maple currency NOPARAM myRates }