Extracting a process Command line arg

Given a process how one extract a command line argument and then extract Java Heap size from the string.

Any input is much appreciated.

Monitored entities api can be used for such data:

Enhacing @rastislav_danis  answer:
You can specifically ask for the properties.metadata field.

https://{environmentid}.live.dynatrace.com/api/v2/entities/PROCESS_GROUP_INSTANCE-xxxxx?fields=%2Bproperties.metadata