sfdx-cli can output json. Is the output documented anywhere?

Running a sfdx command with the json flag will return different json output depending on the command. Here is an example of the kind of output returned from sfdx force:package:version:create ... --json:

{
  "status": 0,
  "result": {
    "Id": "abc123",
    "Status": "Success",
    "Package2Id": "abc234",
    "Package2VersionId": "abc345",
    "SubscriberPackageVersionId": "abc456",
    "Tag": null,
    "Branch": null,
    "Error": [],
    "CreatedDate": "2020-08-08 12:00",
    "HasMetadataRemoved": false
  }
}

Is there any documentation for the json output of these commands?

As far as I can tell the properties in result will be different for each command. It would also be really useful, per command, to know what the range of possible Status values are.

Answer

It’s not generally documented in the context of the CLI command (output of x command), but you can usually find more information based on the underlying objects it’s interacting with.

For example, the command force:package:version:create... is utilizing Package2VersionCreateRequest. Within that you can see the following values defined for Status that it can contain

The status of the Package2Version creation request. Valid values
include:

  • Queued
  • InProgress
  • Success
  • Error

Attribution
Source : Link , Question Author : gburnett , Answer Author : Kris Goncalves

Leave a Comment