{"componentChunkName":"component---src-templates-simple-markdown-js","path":"/process-intelligence-apis/knowledge-model-api/features/sorting/","matchPath":"","result":{"data":{"markdownRemark":{"html":"<h1 style=\"position:relative;\"><a href=\"#sorting\" aria-label=\"sorting permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"sorting\"></div>Sorting</h1>\n<h2 style=\"position:relative;\"><a href=\"#data-endpoints\" aria-label=\"data endpoints permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"data-endpoints\"></div>Data Endpoints</h2>\n<p>The <code class=\"language-text\">/data</code> endpoint provides the ability to allow sorting by using the <code class=\"language-text\">sort</code> query parameter:</p>\n<ul>\n<li>\n<code class=\"language-text\">sort</code>\n : Comma separated list of fields that are being preceded by \n<code class=\"language-text\">\"+\"</code>\n to display in ascending order, or \n<code class=\"language-text\">\"-\"</code>\n for\ndescending order. For example: \n<code class=\"language-text\">sort=+opportunity_value,-opportunity_id</code>\n</li>\n</ul>\n<p>Note that if no +/- prefix is provided, the results will be sorted in ascending order (+) by default.</p>\n<p>Note also, the fields used for sorting must exist for the requested record.</p>\n<h2 style=\"position:relative;\"><a href=\"#schema-endpoints\" aria-label=\"schema endpoints permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"schema-endpoints\"></div>Schema Endpoints</h2>\n<p>Schema endpoints also provide the ability to sort their results by leveraging the <code class=\"language-text\">sort</code> query parameter as follows:</p>\n<ul>\n<li>\nMulti-field sorting is not allowed, i.e. it is not possible to sort by more than one field.\n</li>\n<li>\nFields in the \n<code class=\"language-text\">sort</code>\nquery param should be prefixed with a ‘+’ for ascending order or ‘-’ for descending order.\n</li>\n<li>\nIf no +/- prefix is provided, the results will be sorted in ascending order (+).\n</li>\n<li>\nThe results will be sorted as case insensitive.\n</li>\n</ul>\n<p>Some examples are:</p>\n<ul>\n<li>\nGet all Knowledge Models: \n<code class=\"language-text\">/knowledge-models?sort=+id</code>\n</li>\n<li>\nGet all Filters for a Knowledge Model: \n<code class=\"language-text\">/knowledge-models/{km_id}/filters?sort=-name</code>\n</li>\n<li>\nGet all Records for a Knowledge Model: \n<code class=\"language-text\">/knowledge-models/{km_id}/records?sort=id</code>\n</li>\n<li>\nGet all KPIs for a Knowledge Model: \n<code class=\"language-text\">/knowledge-models/{km_id}/kpis?sort=id</code>\n</li>\n<li>\nGet all Fields (attributes, augmented attributes and flags) for a Record of a Knowledge Model: \n<code class=\"language-text\">/knowledge-models/{km_id}/records/{record_id}?sort=-id</code>\n</li>\n</ul>\n<p><code>pageSize</code> refers to the events returned in the page.\n<code>total</code> refers to the total events still at the API.\n<code>content</code> events as raw JSON.</p>","headings":[{"value":"Sorting","depth":1},{"value":"Data Endpoints","depth":2},{"value":"Schema Endpoints","depth":2}]},"contentItem":{"data":{"lastModified":"2025-10-07T15:06:43.000Z","enableToc":null,"disableLastModified":null,"tocMaxDepth":null,"requestLogin":false}},"siteConfig":{"enableToc":false,"disableLastModified":false,"tocMaxDepth":4}},"pageContext":{"matchPath":"","id":"91390439-6db3-560a-a5f8-c860e8900e6d__redocly content/process-intelligence-apis/knowledge-model-api/features/sorting/","seo":{"title":"Sorting","description":null,"image":"","keywords":null,"jsonLd":null,"lang":null,"siteUrl":null},"pageId":"process-intelligence-apis/knowledge-model-api/features/sorting.md","pageBaseUrl":"/process-intelligence-apis/knowledge-model-api/features/sorting","type":"markdown","toc":{"enable":true,"maxDepth":4,"headings":[{"depth":1,"value":"Sorting","id":"sorting"},{"depth":2,"value":"Data Endpoints","id":"data-endpoints"},{"depth":2,"value":"Schema Endpoints","id":"schema-endpoints"}]},"data":{"title":""},"catalogInfo":null,"link":"/process-intelligence-apis/knowledge-model-api/features/sorting/","sidebarName":"celonis","isLanding":false,"showPrevButton":null,"showNextButton":null,"apiVersions":null,"apiVersionId":null,"isDefaultApiVersion":null}},"staticQueryHashes":["1123603147","1302185487","1344209882","1398840060","1520077861","1975142765","2667623876","2950305614","3240152602","3743992808","561138138"]}