Is there a way get the process definition key by processInstanceId?

I want to get the key by the process instance id.
But the processInstance Object have not a method can get the key.

Can someone tell me how to get the key by process instance id?

Are you looking for the Definition Key for a given process instance?
Using the REST API?

This is a good to have feature for the Get Process Instance API

A brief description about the Enhancement:

Feature Description:

The Get Process Instance API does not return the Process Definition Key in the API response.

https://docs.camunda.org/rest/camunda-bpm-platform/7.21-SNAPSHOT/{url}/process-instance/{id}

How it is currently being handled

To fetch the process definition key associated with a process instance, the end user needs to first make a call to the Get Process Instance API through which the definition ID can be retrieved and then subsequently make a call the Get Process definition API(https://docs.camunda.org/rest/camunda-bpm-platform/7.21-SNAPSHOT/{url}/process-definition/{id}) to retrieve the definition key.

Advantage of having this feature

This feature if added will avert making the additional call to Get Process definition API and the retrieval of process definition key can be supported in a single call using Get Process Instance API.

I will be creating a GIT ISSUE to work on this feature.

GIT Issue : Get Process Instance API to return Process Definition Key value in the API response · Issue #4049 · camunda/camunda-bpm-platform · GitHub
I will be working on this feature.

1 Like

I think there is value in adding this attribute to API response