Global Data API

The Global Data API contains operations for maintaining Global Data and manipulating Global Data Tables records they contain. Global Data or Global Data Tables is not linked to a recipient and can be used for general evaluations. In addition to the fine-grained CRUD operations, Global Data API also provides batch operations for processing sets of records at once. As a rule of thumb: use the batch operations whenever you need to process more than a single record.

The Global Data records can be fetched and updated.

The table and its fields must already have been defined using the Administration interface, as it is not possible to programmatically create new global data tables or fields.

API Use Cases

With the Global Data and Global Data Tables API you can:

  • Retrieve and Update records in Global Data
  • Perform CRUD operations on single or multiple Global Data Table records at once
  • Clear an entire Global Data Table
  • With our Discovery API you can programmatically list the accessible Global Data structures available to the Global Data API.

Examples:

Global Data is used to hold values that are used more than one time (e.g. on multiple templates) and might change over time.

Global Data

Globally used values can be stored in Global Data so it can referred to in multiple templates and changed by one API call.
The list of global data variable defined can be retrieved doing a GET on the Global Data API:

curl -X GET https://api-eu1.agillic.net/globaldata/

will return an array of global data with their name, type and the description:

[
  { 
    "NAME":"COMPANY", 
    "TYPE":"STRING", 
    "DESCRIPTION": "Name of the company" 
  },
  { 
    "NAME":"YEAR", 
    "TYPE":"NUMBER", 
    "DESCRIPTION": "Current year" 
  },
  { 
    "NAME":"MONTH", 
    "TYPE":"STRING", 
    "DESCRIPTION": "Current month" 
  },
  ...
]

You can get a Global Data definition:

curl -X GET https://api-eu1.agillic.net/globaldata/COMPANY

Will return a JSON object if record with NAME COMPANY exists. It will return the value along with all metadata for the field:

{ 
    "NAME":"COMPANY", 
    "TYPE":"STRING", 
    "VALUE": "Candy Store", 
    "DESCRIPTION": "Name of the company", 
    "PUBLISH": "true" 
    "CREATED": "1234567890"
    "MODIFIED": "12345678901"
}

If COMPANY does not exist, it will return HTTP 404 (NOT FOUND).

Update an Global Data:

curl -X PUT https://api-eu1.agillic.net/globaldata/COMPANY \
    --header 'Content-Type: application/json; charset=utf-8' \
    --data   '{ "VALUE": "World Candy Store Inc." }'

Update will return HTTP 20O (OK) if the record was updated, but it will fail if the Global Data is not defined.

Global Data Table API

We usually keep our Candy Stores locations in a Global Data Table named SHOPS.

Using API you can retrieve the existing Global Data Tables by calling the endpoint:

curl -X GET https://api-eu1.agillic.net/globaldata/tables

will return an array of Global Data Table names:

[
    "PRODUCT",
    "BRAND",
    "DISCOUNT",
    "VIDEO",
    "KURSER",
    "DISCOUNT_COPY",
    "LINKS",
    "ARTIKEL",
    "GLOBAL_DATA_TABLE_11FEB2019_155537",
    "SUBSCRIPTION_MAIL",
    "TEST_TABLE_1",
    "REJSEKONSULENT",
    "ACCOUNTS",
    "STORE",
    "BOOK",
    "ARRANGEMENT",
    "TANK",
    "INTERNAT",
    "STORY"
]

Is is possible to retrieve all the records in a table by the following endpoint:

curl -X GET https://api-eu1.agillic.net/globaldata/tables/PRODUCTS

will return all records in the PRODUCT table:

Create a new Candy Store location in Global Data Table SHOPS:

Delete Venus and Mars locations:

Clear PHONEBOOK Global Data Table:

curl -X POST https://api-eu1.agillic.net/globaldata/tables/PHONEBOOK/:truncateTable

API Documentation