Malformed JSON When Using System Queries Containing Dashes in SystemLink

Updated May 25, 2022

Reported In

Software

  • SystemLink Server

Issue Details

I'm not able to use the query system method part of the Systems Management Service from the HTTP API of SystemLink when trying to access packages that contain dashes in their name. What is the way to format the query syntax correctly? 

Solution

In order to use the dashes in the system queries, end-users need to have into consideration that the language used in the HTTP API is Dynamic LINQ. Therefore, end users can follow the syntax rules for this language. 

If end users need to use the query using dashes, the name of the package needs to be formatted as follows:
  • Package name: Package-Example-1 
  • Package name with the proper syntax: [\"Package-Example-1\"]
The following is an example that has been tested with the Swagger tool in SystemLink Server:

{
"skip": 0,
"take": 100,
"filter": "connected.data.state==\"CONNECTED\"",
"projection": "new(packages.data[\"ni-package-manager-upgrader\"].version)",
"orderBy": "lastUpdatedTimestamp descending"
}


The result is the following:

{
  "count": 5,
  "data": [
    {
      "version": "21.8.0.49275-0+f123"
    },
    {},
    {},
    {},
    {}
  ]
}