# Setting up a content source

THIS ARTICLE IS UNDER DEVELOPMENT<span class="mw-headline" id="bkmrk-setting-up-a-content-1"></span>

Many parameters are straight forward

- Related solution
- Max cache age
- Is active

### <span class="mw-headline" id="bkmrk-unique-name-1">Unique NAME</span>

This is the calling name of the interface, that must be provided accessing the content service.

Example for calling the view **myview**

```
.../cmsinterface?q=myview& ...
```

### <span class="mw-headline" id="bkmrk-query-command-1">Query command</span>

Relevant commands include

- General records 
    - list: List of records
    - show: Single record
- HTML formatted views 
    - heat: Heatmaps
    - gant: Gant charts
    - xtab: Pivot tables
    - calm: Calendar

### <span class="mw-headline" id="bkmrk-query-parameters-1">Query parameters</span>

Parameters are provided without URL encoding

```
QUERY_FIELD_1=TITEL&QUERY_OPERATOR_1=8&QUERY_VALUE_1=Hello&QUERY_SHOWFIELD=TITEL StatusID DEADLINE
```

Procedure for easy parameter setup

1. Build views in frontend.
2. Activate the link and copy the URL
3. ´Remove unneeded parameters 
    - command
    - SagID
    - QUERY\_NEW

### <span class="mw-headline" id="bkmrk-possible-parameters-1">Possible parameters</span>

<table id="bkmrk-query_field_n-part-o"><tbody><tr><td>QUERY\_FIELD\_n</td><td>Part of the search/filter. The field to filter by.</td></tr><tr><td>QUERY\_OPERATOR\_n</td><td>Part of the search/filter. The way to filter. Full list [Dashboard widget configuration](https://docs.tsnocode.com/books/dashboards/chapter/dashboard-widget-configuration-Ulo "Dashboard widget configuration")</td></tr><tr><td>QUERY\_VALUE\_n</td><td>Part of the search/filter. The value to filter by.</td></tr><tr><td>QUERY\_SHOWFIELD</td><td>The fields to show in the list, separated by space.</td></tr><tr><td>QUERY\_PageSize</td><td>Number of records to show pr page.</td></tr><tr><td>QUERY\_PageOffset</td><td>The page number to show.</td></tr><tr><td>QUERY\_SortOrder</td><td>The field to sort ascending by. Use either this or SortOrderDesc.</td></tr><tr><td>QUERY\_SortOrderDesc</td><td>The field to sort descending by. Use either this or SortOrder.</td></tr><tr><td>QUERY\_Grouping</td><td>The field to group records by.</td></tr><tr><td>QUERY\_GroupingDesc</td><td> </td></tr></tbody></table>

### <span class="mw-headline" id="bkmrk-dynamic-parameter-1">Dynamic parameter</span>

This specifies a parameter that will be set by the value provided in the **v** parameter.

Example: Using this interface

```
Unique NAME: mylist
Query command: list
Dynamic parameter: QUERY_PageOffset
```

Making a call to

```
.../cmsinterface?q=mylist&v=2
```

Will fetch a list of data and display page 2, because **2** is injected into **QUERY\_PageOffset**.

Parameters and values are injected directly into the http request.

**Note: Using the "show" command the variable will ALLWAYS get mapped to "DataID"**

## <span class="mw-headline" id="bkmrk-using-a-content-sour-1">Using a content source</span>

Calling the **cmsinterface** servlet will provide you with an overview on how to use it.

Example:

```
https://www.acme.com/TempusServa/cmsinterface
```

The interface requires just the name of the source, but additional parameters can be provided.

Parameters

- **q**: Name of the interface (required) 
    - This name must match "Unique NAME"
- **f**: Format of the result (optional) 
    - Valid values: html json xml
- **v**: Parameter for dynamic values (optional) 
    - The value will be substituted to the parameter in "Dynamic parameter"

Example:

```
https://www.acme.com/TempusServa/cmsinterface?q=mysource&f=json
```

## <span class="mw-headline" id="bkmrk-troubleshooting-1">Troubleshooting</span>

THIS ARTICLE IS UNDER DEVELOPMENT

### <span class="mw-headline" id="bkmrk-configuration-cachin-1">Configuration caching</span>

For performance reasons information about the content sources is kept cached.

Adding or changing sources will propegate automatically : You will need to clear the system cache to pick the changes.

### <span class="mw-headline" id="bkmrk-parameter-encoding-1">Parameter encoding</span>

Note that URL's copied from a browser address bar are often encoded in HTML format.

The content will not decode values and request strings, so all encoded strings will fail.