How to get the latest version of a process definition and get the xml within the list?

Hello everyone,
as per this docs: Overview | Camunda 8 Docs
I didn’t find how to only get the latest version when using search Process Definition API, does someone know how to do it?

and also does Camunda Operate API support to expand the xml within the list?
e.g. when query search to get latest version of process definition the original schema is

{
  "items": [
    {
      "key": 0,
      "name": "string",
      "version": 0,
      "bpmnProcessId": "string",
      "tenantId": "string"
    }
  ],
  "sortValues": [
    {}
  ],
  "total": 0
}

but does any capability to be like this:

{
  "items": [
    {
      "key": 0,
      "name": "string",
      "version": 0,
      "bpmnProcessId": "string",
      "xml": "string",
      "tenantId": "string"
    }
  ],
  "sortValues": [
    {}
  ],
  "total": 0
}

Hi @pandika-csgi - the filter parameter in the search query can include any of the properties in the response object schema. In other words, you should be able to include the version parameter because it is a property on the ProcessDefinition object schema.

The search will not return the full XML, however. For that you need to use the GET /v1/process-definitions/{key}/xml endpoint, using the process definition key that you found in the search.

Hope that helps!

Thanks @nathan.loding , yes we can include version, but what paramater to get latest/max version of ProcessDefinition

e.g

{
  "filter": {
    "version": 3 -> # This is not what I want to do, because I dont know latest version for each process definitions
  },
  "size": 50,
  "sort": [
    {
      "field": "bpmnProcessId",
      "order": "ASC"
    }
  ]
}

I don’t know what latest version of each Process Definitions, is there a way like we can put version: latest or anything to get latest version for each of Process Definition

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.