Print this page

How to install the Managed package Via API

Knowledge Article Number 000181447
Description How to install, upgrade and uninstall managed package using The API.
Resolution
You can install, upgrade, and uninstall managed packages using the API. By automating these repeated
tasks, you can work more efficiently and speed up application development..
 
The list of metadata types has been expanded to include a new type called InstalledPackage. You can use this with the
standard Metadata API deploy() call to install, upgrade, or uninstall packages.
• Deploying an InstalledPackage causes the package to be installed into the deploying organization.
• Deploying a newer version of a currently installed package causes the package to be upgraded.
• Deploying an InstalledPackage using a manifest called destructiveChanges.xml, instead of package.xml,
uninstalls it from the organization.
This is a typical project manifest (package.xml) for installing a package. The manifest must not contain a namespace
element.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>InstalledPackage</name>
</types>
<version>28.0</version>
</Package>
The package is specified in a file called MyNamespace.installedPackage, where MyNamespace is the namespace prefix
of the package. The file must be in a directory called installedPackages, and its contents must have this format.
<?xml version="1.0" encoding="UTF-8"?>
<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata">
<versionNumber>1.0</versionNumber>
<password>optional_password</password>
</InstalledPackage>
193
ISVForce Installing and Uninstalling Packages using the API
To uninstall a package, deploy this destructiveChanges.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>MyNamespace</members>
<name>InstalledPackage</name>
</types>
<version>28.0</version>
</Package>
Retrieving an InstalledPackage, using the retrieve() call creates an XML representation of the package installed in
an organization. If the installed package has a password, the password is not retrieved. Deploying the retrieved file in a different
organization installs the package in that organization.
 




promote demote