package version retrieve
Retrieve package metadata for a specified package version. Package metadata can be retrieved for only second-generation managed package versions or unlocked packages.
Retrieving a package version downloads the metadata into the directory you specify.
When you run this command, specify the subscriber package version ID (starts with 04t) and the path to an empty directory.
By default, the package version retrieve command is available to 2GP managed packages that were converted from 1GP. To use this command with a managed package created using 2GP (not converted from 1GP) or with an unlocked package, specify IsDevUsePkgZipRequested = true in the Package2VersionCreateRequest Tooling API object. If you run this command and the zip folder with the package version’s source files is missing, confirm that IsDevUsePkgZipRequested is set to true.
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Override the api version used for api requests made by this command |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑output‑dir | ‑d | Type: Value Default value: force-appPath within your Salesforce DX project directory in which to download the metadata. This directory must be empty. |
‑‑package | ‑p | Type: Value Required Subscriber package version ID (starts with 04t). |
‑‑target‑dev‑hub | ‑v | Type: Value Required Username or alias of the Dev Hub org. Not required if the target-dev-hub configuration variable is already set. |
Retrieve package metadata for a converted subscriber package version ID (starts with 04t) into my-directory/ within your Salesforce DX project directory: