REST API Interface Description
This document describes each endpoint available with the Matrix42 REST API v1. This is a technical interface description - please find the REST API overview here.
Accessing Data Cards
GET /dc/{templateCode}/data
Get all data cards by template code – returns paginated list of data card-information by given template.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| limit | number | Page size – min. 1 max. 200 | * |
| filterId | number | Only data cards with id:s lower than filterId will be returned | |
| filter | string | EQL-filter for the data | |
| dataCards | boolean | Whether to get full data cards or simple info-elements | |
| selectedAttributes | string | Comma-separated list of attributes to be returned |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data?filter=%24status%24%20%3D%20%2702%20-%20Solving%27&selectedAttributes=subject%2Cstatus&limit=2&filterId=0&dataCards=true
Empty results and paging
When no data cards match the request, the endpoint returns 200 OK with an empty data array and meta.count set to 0:
{
"meta": {
"count": 0,
"limit": 50,
"links": {
"next": ""
}
},
"data": []
}Continue requesting pages with the URL in meta.links.next until that value is empty. The last page that contains data can still include a next link, for example when the number of matching data cards is an exact multiple of limit. Requesting that link returns 200 OK with an empty data array and an empty next value. Do not stop paging only because a page is empty or shorter than limit while next still contains a URL.
The endpoint returns 404 Not Found when the template does not exist, when the calling user cannot read the template, or when the template is a system template.
Aggregation in the filter
On GET /dc/{templateCode}/data, the filter parameter does not support GROUP BY or the aggregate functions count, sum, avg, max, and min. A request that includes any of them returns 400 Bad Request. The message field of the error response begins with "Aggregation (GROUP BY / count, sum, avg, max, min) is not supported by the data card list endpoint". Use the filter to select rows only.
GET /dc/{templateCode}/data/stream
Returns all available data cards by streaming. For complex and heavy operations streaming results could provide faster and more efficient results than getting paginated data.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| filter | string | EQL-filter for the data | |
| dataCards | boolean | Whether to get full data cards or simple info-elements | |
| selectedAttributes | string | Comma-separated list of attributes to be returned – if empty, all are returned |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/stream?filter=%24status%24%20%3D%20%2702%20-%20Solving%27&selectedAttributes=subject%2Cstatus&dataCards=true
PUT /dc/{templateCode}/data
Create or edit multiple data cards
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
Example
PUT https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data
BODY
[
{
"folderCode": "incident_management",
"dataCardId": "12345",
"data": {
"description": {
"values": [
{
"value": "Updating incident"
}
]
},
"description": {
"values": [
{
"value": "Description"
}
]
}
}
},
{
"folderCode": "incident_management",
"data": {
"description": {
"values": [
{
"value": "Creating a new incident"
}
]
}
}
}
]
POST /dc/{templateCode}/data
Create a new data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| createEmptyReferences | boolean | Whether to create new references, if reference-value doesn’t exist in system (matched by dataCardId) | |
| dataCards | boolean | Whether to get full data cards or simple info-elements |
Example
POST https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data
BODY
{
"folderCode": "incident_management",
"data": {
"description": {
"values": [
{
"value": "Creating incident"
}
]
},
"description": {
"values": [
{
"value": "Description"
}
]
}
}
}
GET /dc/{templateCode}/data/{dataCardId}
Get a single data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| selectedAttributes | String | Comma-separated list of attributes to be returned – if empty, all are returned |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345
DELETE /dc/{templateCode}/data/{dataCardId}
Delete a single data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
Example
DELETE https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345
PATCH /dc/{templateCode}/data/{dataCardId}
Edit existing data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| createEmptyReferences | boolean | Whether to create new references, if reference-value doesn’t exist in system (matched by dataCardId) | |
| dataCards | boolean | Whether to get full data cards or simple info-elements |
ExamplePATCH https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345
BODY
{
"folderCode": "incident_management",
"data": {
"description": {
"values": [
{
"value": "Creating incident"
}
]
},
"description": {
"values": [
{
"value": "Description"
}
]
}
}
}
GET /dc/{templateCode}/data/{dataCardId}/{attributeCode}
Get attribute from data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/subject
PUT /dc/{templateCode}/data/{dataCardId}/{attributeCode}
Update attribute from data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
Example
PUT https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/subject
BODY
{
"values": [
{
"value":"Updating subject"
}
]
}
POST /dc/{templateCode}/data/{dataCardId}/{attributeCode}
Add value to attribute from data card
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
Example
POST https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/subject
BODY
{
"values": [
{
"value":"Adding value to subject"
}
]
}
DELETE /dc/{templateCode}/data/{dataCardId}/{attributeCode}
Clear value of attribute from data card.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
Example
DELETE https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/subject
GET /dc/{templateCode}/data/{dataCardId}/{attributeCode}/file/{locationOfExternalData}
Download a file, or a complete e-mail message, from an attribute of a data card. See Attachments and e-mail messages for how to find the location of a file.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
| locationOfExternalData | String | The location of the file. Use the value of the location field that is returned for the file when you read the data card, for example 20210512_01.msg. |
* |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/email/file/20210512_01.msg
RESPONSE
Status 200 with the content type application/octet-stream. The response body is the file exactly as it is stored. If the file does not exist for the attribute, the response is status 404 with a message that starts with “File not found”.
POST /dc/{templateCode}/data/{dataCardId}/{attributeCode}/file
Upload attachment to data card.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
| dataCardId | number | Data card id | * |
| attributeCode | String | Attribute code | * |
| locationOfExternalData | String | Internal location of the file, e.g. 20210512_01 | * |
Example
POST https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/subject/file/20210512_01 -H "Content-Type: multipart/form-data" -F "fileName=example.png" -F "fileUpload=example.png;type=image/png"
Attachments and e-mail messages
With the file endpoints, your integration can read the files and the e-mail messages that a data card holds and process them in your own tools. For an e-mail messages attribute you get each message as a complete message, with headers, body and attachments.
Before you start
The examples in this section use the base address https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1. If the address you use to open the application in a browser ends with /itsm, use only the host name of that address in front of /rest-api/itsm/v1. Log in with the user name and password of a local user that has the External API permission, and send the token you receive in the Authorization header of every request exactly as it is returned. The token already starts with Bearer . The REST API Overview describes the login request and shows how to test your connection.
Which attributes hold files
File attachments and e-mail messages are both returned as attributes of the type external-reference with file set to true when you read a template with GET /dc/{templateCode}. The template does not tell the two apart, so identify the e-mail messages attribute by its name in the template configuration. The attribute code is the key of the attribute in the attributes object of the template response. The same code is the key of the attribute in the data object of every data card.
Find data cards that have e-mail messages
List the data cards of the template and ask only for the e-mail messages attribute. This example uses the attribute code email.
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data?selectedAttributes=email&dataCards=true&limit=50&filterId=0
Each data card in the data array of the response contains the attribute in its own data object. Cards without messages have an empty values array, so skip those. Use the meta.links.next address to read the next page, as described in Empty results and paging.
Download a file or an e-mail message
- Take the
downloadpath from thevaluesarray of the attribute. The list response above already contains it. You get the same values by reading a single data card withGET /dc/{templateCode}/data/{dataCardId}. Each file or message is an object with the fieldsname,locationanddownload. - Add the base address
https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1in front of thedownloadpath and send a GET request to the result, with the same Authorization header.
The attribute looks like this in the response:
"email": {
"name": "E-mail messages",
"type": "external-reference",
"values": [
{
"name": "20210512_01.msg",
"location": "20210512_01.msg",
"download": "/dc/incident/data/12345/email/file/20210512_01.msg"
}
]
}The following request downloads the message and saves it to a file:
curl "https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data/12345/email/file/20210512_01.msg" \
-H "Authorization: <token>" \
-o message.emlThe response has the content type application/octet-stream. The messages that were sent and received through the data card are stored as plain text messages in the RFC 822 format, although the file name ends in .msg. The response contains the complete message with all headers, the body and the attachments. Any library or client that reads e-mail messages in the RFC 822 format can open the saved file. If the attribute has no messages, the values array is empty.
Comments
You can read and add the comments of a Comment handler attribute through the REST API. You cannot replace an existing comment with a PUT request.
Read comments
Send a GET request to /dc/{templateCode}/data/{dataCardId}/{attributeCode}. The response lists the comments of the attribute, newest first. Each comment contains the fields value, author, commentType, and date. The author is the name of the person who wrote the comment, and date is the time when the comment was created in Pro ESM.
Add comments
Send a POST request to /dc/{templateCode}/data/{dataCardId}/{attributeCode}. Put one or more comments in the values array:
{
"values": [
{ "value": "Text of the comment" }
]
}Pro ESM assigns the author from the user who sends the request and sets the creation time to the server time. Do not include author, date, or commentType in the request. The request fails with status 400 if any of these fields is present, or if a comment is empty.
Delete comments
A DELETE request to /dc/{templateCode}/data/{dataCardId}/{attributeCode} removes all comments of the attribute. You cannot delete a single comment. The request needs permission to update the attribute and the template, and it is subject to the data card lock.
Data card lock
If the data card is locked, a POST request returns status 409. The request succeeds without a lock check when the Comment attribute has the Ignore data card lock (true/false) option set to true. The platform setting external.api.check.lock.on.datacard is enabled by default. When you disable it, the REST API does not check the lock for any request. Setting names and availability can change between versions.
To save the parent data card together with the comment, add the query parameter forceDataCardSave=true. Such a request is subject to the lock check even when the Ignore data card lock (true/false) option is enabled.
Accessing Templates
GET /dc
Get list of all templates.
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc
GET /dc/{templateCode}
Get template by code.
REQUEST
PATH PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| templateCode | string | Template-code | * |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident
How to Test the Interface
GET /echo
Returns the content of "message" query parameter. For testing purposes.
REQUEST
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| message | string | String to be echoed back | * |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/echo?message=Hello%20world
GET /echo/jwt
Returns the content of "message" query parameter if JWT-token is valid. For testing purposes.
REQUEST
QUERY PARAMETERS
| NAME | TYPE | DESCRIPTION | REQUIRED |
|---|---|---|---|
| message | string | String to be echoed back | * |
Example
GET https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/echo/jwt?message=Hello%20world
Troubleshooting
REST API Errors
In case of any errors - caused for example, by failed authorization, erroneous parameters or a badly formatted query – the API will respond with standardized error-response:
{
"code": 401,
"message": "Token was empty or not provided. Token should be provided in AUTHORIZATION header.",
"error": "Unauthorized",
"url": "https://yourMatrix42environment.m42cloud.com/rest-api/itsm/v1/dc/incident/data?limit=50&filterId=0",
"timestamp": "2021-12-21T11:41:22Z"
}
The response will always include “code”, “error”, “url” and “timestamp” and in most of the cases “message”, giving details about the underlying issue.
Possible Errors
| CODE | ERROR | DESCRIPTION |
|---|---|---|
| 400 | Bad request | Bad request, such as incorrect formatting or parameters. |
| 401 | Unauthorized | JWT-token missing from the request. |
| 403 | Forbidden | User lacks permissions for the operation – usually user has only read-permission to resource, but no create-, update- or delete-permission. |
| 404 | Not found | Not found – either resource doesn’t exist, or user lacks read-permission to see it. Additionally, system templates are filtered out. |
| 409 | Conflict | Trying to delete already deleted data card, or the data card is locked. |
| 413 | Request too large | Uploaded file was too large. |
| 415 | Unsupported media type | The file type of an uploaded file is not allowed. File type validation is not used by default, but an administrator can turn it on in the platform settings. See File Upload Security. For uploads through the REST API, the hidden platform setting file.upload.type.validation.integrations.enabled must also be on. It is off by default in version 2026.2.0. Setting names and availability can change between versions. |
| 429 | Too many requests | Rate limit exhausted. |
Can’t acquire JWT-token from login-endpoint
To get a JWT-token, the user used for login needs to have a role assigned with permission to ‘External API’ -module. If the user does not have the permissions for the External API-module, the login-endpoint response will contain information about insufficient permissions.
If you get unauthorized-response even though the username and password are correct and the role has the right permissions, make sure the account is a local account and not an EIM account. If the login request returns status 500 with an empty response, check that the request body is form data with the fields login and password. A JSON body is not accepted. See the login example in the REST API Overview.
Attribute isn’t nullable and if you send a “” as value, field isn't empty anymore
String-type attribute contains the following options: string |number | date
With StaticValue:
- Value - string
- code - string
- nullable - True
Therefore, if you want empty attribute value via REST API, use this syntax:
"email": {
"values": [
{
"value": null
}
]
}
Table of Contents