Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export plugin zip using API

Export plugin zip using API

IdentityIQ plugins are persisted to the database which are accessed by sailpoint.object.PersistedFile. Chunk of a file is written to the database and accessed by sailpoint.object.FileBucket. For larger files, break them up into FileBuckets so that they can be read into and out of the database efficiently.

Sometimes it's needed to export the installed plugins from the IdentityIQ but IdentityIQ doesn't provides a user interface to export the installed plugin. However, IdentityIQ provides APIs which can be leveraged to export the installed plugin and save plugin zip file on physical drive on the server where IdentityIQ is running.

Below sample code for exporting the plugin zip:

import sailpoint.object.Plugin;
import sailpoint.object.QueryOptions;
import sailpoint.object.PersistedFile;
import sailpoint.object.Filter;
import sailpoint.object.FileBucket;
import java.nio.file.Files;
String byteString = "";
String pluginName = "Provide Plugin Name";
String pathToSavePluginZip = "D:/";
Plugin plugin = context.getObjectByName(Plugin.class,pluginName);
if(plugin !=null){
PersistedFile persistedFile = plugin.getFile();
if(persistedFile !=null){
QueryOptions qo = new QueryOptions();
Filter filter = Filter.eq("parent", persistedFile);
qo.addOrdering("fileIndex", true);
List fileBucketList = context.getObjects(FileBucket.class, qo);
if(fileBucketList !=null && !fileBucketList.isEmpty()){
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
for (FileBucket fileBucket : fileBucketList) {
outputStream.write(fileBucket.getData() );
Files.write(new File(pathToSavePluginZip+pluginName+".zip").toPath(), outputStream.toByteArray());
log.debug("Plugin exported successfully.");
log.debug("FileBucket is null or empty.");
log.debug("PersistedFile not found.");
log.debug("Plugin not found.");
}catch(Exception e){
log.error("Error while exporting plugin : "+e.toString());

Labels (2)

Plugin can be exported using IIQ plugin CLI command: plugin export <pluginname>

Thanks @kalyankumar_saha. good to know.

Version history
Revision #:
6 of 6
Last update:
‎Jul 24, 2023 04:44 PM
Updated by: