Data access API

Availability

Infradox XS 27.2 or later

Article status

Not final

Related articles

PACA search API

Infradox 3rd party API

Data feeds for galleries

Introduction

This article describes the built-in API functions that are available to retrieve data from your Infradox website database for integration with e.g. backoffice applications, other websites, Wordpress front ends and so on. The API function described in this article is used to fetch data only, it can not be used to change data in the website database.

Note that this article does not describe the Infradox 3rd party API which is used to set up live search links and/or syndication. If you are looking for information about the 3rd party API then please read this article instead: Infradox 3rd party API.

You can access gallery data in JSON format without using the Data access API. To find out more about this, please read this article: Data feeds for galleries.

Access Keys

The Data Access API requires a unique key to make sure that your data can't be accessed without the required permissions. If you need the key value, you can find it via Site configuration, Data access keys. You can not create a new key yourself so create a ticket on zendesk if you want to use this function.

Access can be restricted to one (or several) IP addresses and you can specify permissions (what can be accessed) too.

Website Access

If you need to access state information - e.g. when integrating a Wordpress or other website with the Infradox website - you can use the API to retrieve information about the current user's session so that you can for instance display or hide menu items depending on whether the user is logged in or not. 

Getting session information

Example URL:

  • http://www.web.com/api/www?key=21696-9E8E04-27B9E&cmd=sessiondata&si=97EC27B9E8E04BAF98E06216965396

Example result:

  • {"nologin":0,"sesid":"97EC27B9E8E04BAF98E06216965396","dfc":".web.com","qckdef":"Keywords", "qckevt":"Name of set","evts":0,"uid":0,"ul":"","agt":0, "ors":1,"search":{"latest":0,"contributor":{"id":0,"display":"","query":"","profile":0},"evts":0}, "gst":{"e":0,"s":1,"p":1}, "localeid":1, "localefldr":"us", "terr":{"id":18,"rtt":1,"rtb":2} }

This will retrieve a JSON object with state information for the session id that you have specified. Infradox websites store the session id in the browser's cookies. The cookies are read from page to page.The command (cmd) is sessiondata and the si parameter represents the user's session id.

The attributes available in the JSON object will vary depending on whether the user is logged in or not, and the user's permissions.

Getting a new session id

Example URL:

  • http://www.web.com/api/www?key=key=21696-9E8E04-27B9E&cmd=getsession

Example result

  • {"session":"97EC27B9E8E04BAF98E06216965396","guest":1} 

Getting HTML / page fragments

Example URL:

http://www.xsdevelop.com/api/www?cmd=html&t=templatename&key=21696-9E8E04-27B9E&si=97EC27B9E8E04BAF98E06216965396

To retrieve an HTML page or page fragment, use the t= parameter to specify the template to use. You can for instance retrieve the HTML for the menu or the page footer and insert it into your Wordpress site. We don't publish the values that you can use for the t= parameter here. Create a ticket if you need help.

Database Access

Use

http://www.web.com/api?key=your-access-key&get=what-to-get&page=page-number&max=number-of-rows-to-fetch&sort=sort-order&desc=sort-order

The above example uses the following parameters which are used always, although some parameters are optional: 

  • key
    The value of your API key 
  • get
    The predefined name of the data you want to fetch, e.g. contributors 
  • page
    The number of the page that you are retrieving. E.g. 1 for the first page and to fetch [max] rows (below).
    If you want to fetch row 1001 to 2000, then you would specify page=2 and max=1000.
  • max
    The number of rows to fetch, expects a number between 1 and 1000. 
  • order
    The predefined sort order [optional]
  • desc
    0 for ascending sort order, 1 for descending sort order [optional]
  • lastid
    Supply a value for lastid  to fetch only rows with an ID that is larger than lastid. E.g. if the last row that you fetched had and id with the value 2000 then supply the value 2000 the next time to fetch only rows that were created after the last time you retrieved data (assuming that you retrieved ALL data the last time).
  • format
    Depending on the data that you are retrieving you can use either format=json or format=csv 
  • delimiter
    If the format is CSV, then you can specify a delimiter. e.g. a delimter=". [optional]
    Note that if you specify a delimiter, this value will be removed from the field values to avoid confilicts.
  • titles 
    If the format is CSV then you can use the titles=1 parameter to include a titles row 

There may be other (optional and/or required) parameters depending on the data that you are fetching.

Data that you can fetch

Contributors

Use the get=contributors parameter to retrieve the suppliers/contributors.

Background information

For more information about suppliers and contributors, please read the following articles:

Example

/api?key=9AA02XE5-1543-4F40-93AA-2BEABB1A46D&get=contributors&page=1&max=1000&sort=1

Parameters

  • You can use all standard parameters as described above

Optional parameters

  • group
    If you want to retrieve contributors from a specific group only, then use the group parameter, e.g. group=200 
  • user
    0 only rows from the suppliers table that are not linked to a user account
    1 only rows from the suppliers table that are linked to a user account
  • profile
    0 only suppliers that don't have a profile
    1 only suppliers that have a profile
  • galleries
    0 do not include data for galleries linked to the supplier
    1 include data for galleries linked to the supplier (JSON only)
  • id
    The id of the supplier if you want to fetch data for a single specific supplier only

Sort parameter

  • 0 group id, contributor id [default]
  • 1 contributor id
  • 2 display name
  • 3 creation date/time
  • 4 contributor sort name

You can add the desc=1 parameter to change the default sort order to descending.

 

Users

Use the get=users parameter to retrieve the users.

Example

/api?key=9AA02XE5-1543-4F40-93AA-2BEABB1A46D&get=users&page=1&max=1000&sort=1&lastid=1000

Parameters

  • You can use all standard parameters as described above

Optional parameters

  • deleted
    Use deleted=1 to include users that were marked as deleted, by default such rows are excluded
  • disabled
    Use disabled=1 to include users that are not enabled (i.e. can't login), by default only enabled accounts are retrieved
  • countryid
    Supply an id of a country to fetch users from that country only (e.g. 18 = United Kingdom)
  • startdate
    Supply a date (dd-mm-yyyy) to fetch users that were created in the database after this date
  • enddate
    Supply a date (dd-mm-yyyy) to fetch users that wre created in the database before this date
  • lastloginbefore
    Use this date parameter to fetch users who last logged in before this date (dd-mm-yyyy)
  • lastloginafter
    Use this date parameter to fetch users who last logged in after this date (dd-mm-yyyy)

Sort parameter

  • 0 last name [default]
  • 1 creation/registration date
  • 2 last login date
  • 3 organisation name

You can add the desc=1 parameter to change the default sort order to descending.

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk