What are default elements of per file metadata

I understand that the per-file elements .metadata.json are a combination of "core" octoprint elements plus additional ones that can be added by plugins.

I would like to know what are the core elements that are always included.
The API documentation File operations β€” OctoPrint master documentation seems to imply that the following elements are core. But I would like to confirm.

{
      "name": "whistle_v2.gcode",
      "path": "whistle_v2.gcode",
      "type": "machinecode",
      "typePath": ["machinecode", "gcode"],
      "hash": "...",
      "size": 1468987,
      "date": 1378847754,
      "origin": "local",
      "refs": {
        "resource": "http://example.com/api/files/local/whistle_v2.gcode",
        "download": "http://example.com/downloads/files/local/whistle_v2.gcode"
      },
      "gcodeAnalysis": {
        "estimatedPrintTime": 1188,
        "filament": {
          "length": 810,
          "volume": 5.36
        }
      },
      "print": {
        "failure": 4,
        "success": 23,
        "last": {
          "date": 1387144346,
          "success": true
        }
      }
    }

The API documentation doesn't necessarily reflect the contents of the .metadata.json file. That won't include links for example.

If you want the data model for the files API, which is where you got this example from, that's here Common data model β€” OctoPrint master documentation

The internal metadata file follows a similar structure, and properties will/won't be available for similar reasons. There is no separate data model documented for the internal metadata however.

So are you saying there is no documented list for the core per-file elements of metadata.json?

The reason I need this is that I want to get the minimal common set of elements without including all the extra information added by other plugins.
(specific case here is Obico that passes the metadata for each file being printed to the Obico server -- however packet size is limited to 1300 bytes which gets exceeded when you add all the metadata from all 3rd party plugins -- so I am looking to include only the core keys plus the obico key. I am working on patching this to prevent the overflow case.)

Pretty certain what you are looking for is on that page linked, speciically the files section.

https://docs.octoprint.org/en/master/api/datamodel.html#files

OK. Thanks. I am using those for now though some of the listed keys are not present in my real-world .metadata.json files

Yeah, things like origin aren't in the json file physically and are added as part of the api request. What is displayed and accessible from the UI's file list uses the API.

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