Find out what parts are in use

Enonic version: 7

I need a method to find out which parts are in use. Any suggestions to how I can achieve this?

Every content has on it a property “page” that lists the components on it. You could do a query and get the data from this object. I suggest you using ContentViewer to check how this object is structured, since your parts can be directly in the page regions or inside a layout region.

"page": {
    "type": "page",
    "path": "/",
    "descriptor": "",
    "config": {},
    "regions": {
      "main": {
        "components": [],
        "name": "main"

FYI, for XP7 querying for this info is really easy, but you actually need to look at the node level properties structure to make this Query. Content api provides an abstraction.