Skip to main content
Matrix42 Self-Service Help Center

Fragments Data Service: Get a list of Fragments

Details

Retrieves a list of fragments with a defined list of columns which match the specified search criteria and are sorted in the defined order. In case of need, the method returns the schema metadata for the returned data.

Request

URL

The URL which returns only the requested data has the following format

GET  http(s)://{server}/M42Services/api/data/fragments/{ddname}?where={where}&columns={columns}&
        pagesize={pagesize}&pagenumber={pageNumber}&sort={sort}&includeLocalizations={includelocalizations}

In case the additional  schema meta-data about the selected attributes  has to be included in the response, like data type of attributes, then the following link needs to be used 

GET  http(s)://{server}/M42Services/api/data/fragments/{ddname}/schema-info?where={where}&columns={columns}&
        pagesize={pagesize}&pagenumber={pageNumber}&sort={sort}&includeLocalizations={includelocalizations}

 

URL Attributes and Query Parameters

Element Description Type Required
ddName The technical name of the Data Definition (e.g. SPSActivityClassBase) string Required
where A-SQL Where Expression.  If no filtering expression is specified, the Service returns all fragments of the specified Data Definition which are allowed for the caller.
More information  please see ASQL
string Optional
columns A-SQL Column expression defines the columns in the result set, separated by Comma. If no Columns defines, then the Operation returns only Fragment Ids. 
Example: Name, Parent.Name as ParentName
string Optional

pageSize

Sets the number of records (fragments) returned by Operation. Used in combination with the PageNumber parameter integer Optional
pageNumber Sets the Number of the page. Used in combination with PageSize property. integer Optional
Sort Defines the sorting in the result. Example: "Name ASC, CreatedDate DESC" string Optional
includeLocalizations Specifies if the Localization table should be included in the result. The parameter works ONLY with the request with "schema-info" directive. 
The service handles correctly only attributes of the requested Data Definition.  Related attributes which are part of the response, but not in Data Definition (e.g.  SPSActivityClassBase: Category.Name) keep only values of the request culture. If you need all localizations for these attributes as well, please run a dedicated request to Data Definition which keeps this attribute (e.g. SPSScCategoryClassBase)
boolean Optional

Headers

For a list of available HTTP request headers see Web Services: REST API integration.

Response

Returns

An array of JSON objects where each object represents the Data Definition fragment which matches the specified search criteria and is allowed for the current user (caller). 

The response for the simple data mode request has the following format:

[
    {
        "DisplayString":"{Fragment Display String}",
        "ID":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "Column1": value
    }
]

If you call the method with the extended schema meta-information (the URL with "schema-info" directive), then the response has another format

{
    Result: [{
        "DisplayString":"{Fragment Display String}",
        "ID":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "Column1": value
    }],
    Schema: [{
        "ColumnName":"Column1",
        "ColumnType": {StringType | DateType | IntergerType | ...},
        "Localizable": {true | false}
    }],
     ResultLocalization: [{
        "ID": value,
        "Owner": <fragmentID>
        "LCID": value,
        "Column1": "Column1 localization value"
    }]
}    

Status Codes and Errors

The following table lists the returned HTTP status codes.

Code Description
500
  • Defined Data Definition is not found
  • The specified Where or Columns ASQL expressions are not valid

 

Examples

Example 1: Read Service Desk categories 

The example obtains all the list of Service Desk categories which

  • Have a Parent category. 
  • Each found category contains columns: ID, Name of the Category, Name of the parent Category.
  • Names of the categories are expected in German.
  • All the categories need to be sorted by name. 
  • Result fetches up to 3 category 
GET http://localhost/m42Services/api/data/fragments/SPSScCategoryClassBase?columns=ID,Parent.Name as ParentName,Name&where=Parent IS NOT NULL&Sort=Name asc&pageSize=3

Authorization: Bearer {token}
Explicit-Language: de

 

Response

[
   {
      "ID":"9282a500-caea-49bb-944f-9d0274fcc80a",
      "ParentName":"Organisation",
      "Name":"Ablage",
      "DisplayString":"Ablage"
   },
   {
      "ID":"8ba5e53d-3b6b-425a-baba-34438845f00d",
      "ParentName":"Einkauf",
      "Name":"Abschluss",
      "DisplayString":"Abschluss"
   },
   {
      "ID":"cbbec585-0184-4ae3-ab68-7caeb3d0e5b2",
      "ParentName":"Vertrieb",
      "Name":"Abschluss",
      "DisplayString":"Abschluss"
   }
]
  • Was this article helpful?