Types REST API endpoint
Disclaimer: This endpoint documentation is generated from the latest Sitevision version. It might differ from the actual Sitevision environment where your website resides.
Use the RestApi utility of the Public API for server-side access of this endpoint.
Types
Retrieving data about articles and pages that uses a typed template.
This is a ROOT handler - not bound to a specific Context Node.
GET
Returns an array of entries that matches a specific type.
Parameters
| Name | Type | Default | Values | Description |
|---|---|---|---|---|
| order | string |
MODIFIED_DESC for the offline version (0). PUBLISHED_DESC for the online version (1) | CREATED_ASC, CREATED_DESC, MODIFIED_ASC, MODIFIED_DESC, PUBLISHED_ASC, PUBLISHED_DESC | The time-based order of the entries in the result. Beware that not all entries might be PUBLISHED in the offline version (0)! |
| tags | array |
An array of (any) tag names the returned typed entries must have (OR condition is used when multiple tag names are specified). | ||
| skip | number |
0 | Any positive value | Skips leading number of typed entries. |
| limit | number |
10 | 1-500 | Limits the number of typed entries to return. |
| properties | array |
An array of properties to return. If omitted, no properties are returned. All properties are returned if array contains a wildcard, i.e. ["*"]. |
||
| includeLinkedContent | boolean |
false | Whether or not content from linked layouts/portlets should be included in the response. | |
| fields | array |
An array of fields to return. All fields are returned if omitted, if array is empty or if array contains blank items only. | ||
| textPortletFormat | string |
PLAIN | PLAIN, JSON, MARKDOWN | The data format for text portlets in the returned result. (MARKDOWN since 2025.07.1) |
Example URL
types/event
Example input
{
"limit": 2,
"properties": ["URI", "lastModifiedDate"],
"fields": ["heading", "content"]
}
Example response
[
{
"id": "4.416c4aa618b1325e12f1",
"name": "One",
"tags": ["office"],
"properties": {
"URI": "/4.416c4aa618b1325e12f1.html",
"lastModifiedDate": 1696836289911
},
"fields": {
"heading": {
"name": "Rubrik",
"id": "12.416c4aa618b1325e12f9",
"type": "text",
"properties": {
"textContent": "The One"
}
},
"content": {
"name": "Innehåll",
"id": "12.416c4aa618b1325e12fa",
"type": "text",
"properties": {
"textContent": "The content of one..."
}
}
}
},
{
"id": "4.3d7e9ee718aff2169c61",
"name": "Two",
"tags": [],
"properties": {
"URI": "/4.3d7e9ee718aff2169c61.html",
"lastModifiedDate": 1696497605814
},
"fields": {
"heading": {
"name": "Rubrik",
"id": "12.3d7e9ee718aff2169c69",
"type": "text",
"properties": {
"textContent": "Second one"
}
},
"content": {
"name": "Innehåll",
"id": "12.3d7e9ee718aff2169c6a",
"type": "text",
"properties": {
"textContent": "The content of second..."
}
}
}
}
]
Specifying the type value
The type value can be specified in the input instead of in the URL.
If the type value is specified in both URL and input, the URL value will be used.
| Name | Type | Description |
|---|---|---|
| type | string |
The name of the type. Can be specified as parameter (if not specified as part of the URL) |
Hence, the above call example can also be expressed as:
types
{
"type": "event",
"limit": 2,
"properties": ["URI", "lastModifiedDate"],
"fields": ["heading", "content"]
}
Alternate URL example
Getting data for an individual, specific typed entry.
Example URL and input
-
With explicit type validation (i.e. the given entry must match given type)
types/event/4.416c4aa618b1325e12f1
{ "properties": ["URI", "lastModifiedDate"], "fields": ["heading", "content"] } -
Without explicit type validation (i.e. entry is returned, no type validation at all - more efficient).
types/4.416c4aa618b1325e12f1
{ "properties": ["URI", "lastModifiedDate"], "fields": ["heading", "content"] }
Example response
{
"id": "4.416c4aa618b1325e12f1",
"name": "One",
"tags": ["office"],
"properties": {
"URI": "/4.416c4aa618b1325e12f1.html",
"lastModifiedDate": 1696836289911
},
"fields": {
"heading": {
"name": "Rubrik",
"id": "12.416c4aa618b1325e12f9",
"type": "text",
"properties": {
"textContent": "The One"
}
},
"content": {
"name": "Innehåll",
"id": "12.416c4aa618b1325e12fa",
"type": "text",
"properties": {
"textContent": "The content of one..."
}
}
}
}
Server-side invocation
Server-side invocation of the model REST API endpoints are performed using the RestApi utility of the Sitevision Public API. You should use the Root as Context Node and specify the type value as an Option when invoking endpoints of the types handler.
RestApi examples
Get the array of entries that matches a specific type:
// Get the RestApi utility and ResourceLocatorUtil
//
// a) In a WebApp/RESTApp you would use import:
// import restApi from '@sitevision/api/server/RestApi';
// import resourceLocatorUtil from '@sitevision/api/server/ResourceLocatorUtil';
//
// b) In a Script module or legacy WebApp/RESTApp you would use require:
// const restApi = require('RestApi');
// const resourceLocatorUtil = require('ResourceLocatorUtil');
const root = resourceLocatorUtil.getRootNode();
const options = {
type: 'event',
limit: 2
};
const result = restApi.get(root, 'types', options);
if (result.statusCode >= 200 && result.statusCode < 300) {
// Handle the result.body data...
} else {
// Handle failed invocation...
}
Get data for an individual, specific typed entry:
...
const root = resourceLocatorUtil.getRootNode();
const entry = resourceLocatorUtil.getNodeByIdentifier('4.416c4aa618b1325e12f1');
const options = {
type: 'event'
};
const result = restApi.get(root, 'types', entry, options);
...