MENU

Usage: Pagination / Sorting / Filtering / Types

End Points

This is our secure API URL:  https://api.cms-tool.net/api/

You can append any of our end points on the end, eg https://api.cms-tool.net/api/products

More Endpoints and Data Definitions

There may be legacy URLs and endpoints that still work, but you should ideally use the published endpoint URLs

Authentication

Authentication is availble as OAuth or API keys

Retrieving Data

Use GET to retrieve data.

You can use Accept Header to retrieve data in JSON or XML, or CSV.

Examples: Use Accept:application/xml to get response data in XML. Or use "text/csv" to receive CSV results. The default format for the response will be json otherwise. All processing on the back end works with JSON, and we convert to your desired format as a final step. It is preferable that you work with JSON.

The JSON data is always returned inside a JSON API status wrapper, indicating if your API reqest was "success":true, or "success":false, or "error":"error message here".

The actual data you desire, will be in the json element:   "data":{}  

Or if you requested a list of objects, where no ID was given, then you would get an array object  "data":[{},{}]  

Some end points include plural named options. In general, if you POST, or GET using an ID, you will get a single JSON data object back, otherwise, it will be an array. Sometimes there is a helper element to tell you the "dataType"

Filtering Data

When retrieving lists of data, you can use ordinary request parameters to filter or sort the data, or control pagination.

LIKE filtering

Some keywords and text fields allow for substring / like searches... 

By default, all searches for a LIKE field, will be treated as substring searches, with wildcards added to the search term before/after the text provided.

Any spaces will be converted to wildcards. 

For example searching for "hip mus" would find both "hippopotamus" and "hip music"

The official wildcard characters are % and _ for a single character transition. 

matchType filtering

You can use an additional parameter matchType in some endpoints. Possible matchType values:
IN, ILIKE, LIKE, <=, >=, <, >, <>.
When using the IN matchType please provide the values as comma separated. Example name=100,200,150

Pagination

You may control the pagination of long lists by providing the following request parameters. Values should be integers and greater than 0. The total row count may or may not be provided, depending on the end point. There is no pagination on file lists, but for faster response times on a website, you should aim to have less than 1000 files per directory.

Offset=200   (Default 0)

PageSize=200   (Default 200, max 1000 rows) 

Sorting Data

Please add a "orderBy" parameter, with one of the following values: "Created,Code,Name,LastModified" 

More options may be available for some end points. By default, created date is the default order

You can reverse the order by adding another parameter: orderDirection=reverse

Null Values

Our APIs generally will not return NULL values. For a reduced bandwidth, and easier debugging, we only include attributes with values. Your consuming client applications should cope with the non existence of a field, treating no key as a null, not an exception.

Date Values

We prefer the format yyyy-MM-dd HH:mm:ss, but you can use most common API date formats, and we will do our best to parse those dates. Please avoid using d/m/y or m/d/y dates for obvious reason, that we cannot be sure which is which. 

Date values are provided in a string format in JSON

Decimals

Some decimals are available to 3 decimal points, including some prices and quantities. Most others are 2 decimal points. Rounding should occur automatically if you provide 

You can supply decimals as text, but may throw an error if not valid format

Booleans

Our interface provides most booleans as text "t" or "f" or null, some boolean values are presented as a clean json boolean eg "true". Please ensure your interface can accept "t" or pure Boolean answers interchangeably, as this mainly relates to a legacy bug, and many legacy boolean fields being stored as single chars in the database.

We can accept booleans as pure booleans like true,false or as text like so: T,F,1,0,t,f,Y,N

Posting Updates

You can post your JSON payload inside a "data" request parameter...

Or you can set your header ContentType="text/json", with the content body being your JSON data

Alternatively, you may use a multipart form post content type, if you are uploading files with your API request.

For clarity, our assumption is that the posted data is in json format (or raw text/file). We do not currently accept other formats.

JSON Array Updates

You can send multiple updates for the same end point using a JSON Array rather than a JSON Object

If you use arrays, do not put your ID in the URL. Otherwise, all updates would be applied to the object with that ID

If you use arrays, some nested data may not be updated or retrieved. For example, variants will be retrieved for a single product request. But in array mode, the variants will be ignored. 

Publishing

If you need to trigger a publish of your website, where SEO filename content is involved, then use the following endpoint and parameter (authentication required). Publishing is queued, so it can take 5 minutes to happen. 

https://api.cms-tool.net/api/apistatus?doPublish=1