Prodly API

This Prodly application programming interface (API) replaces the original, deprecated API.

Overview 

This topic describes the Prodly application programming interface (API). The API helps integrate continuous delivery and release management systems to automatically perform deployments. For example, use API requests to deploy a data set or deployment plan.

The Prodly API is a RESTful API that allows you to integrate deployments into a larger continuous integration process. Prodly API requests use the Force.com REST API to invoke actions. It also supports global Apex services for internal Salesforce automation.

These API services are available:

  • Apex REST Services
  • Global Apex Services

Apex REST Services 

Prodly REST services provide consumers and integrated systems outside of Salesforce the ability to invoke deployments and perform other actions through REST-based API requests exposed by the Salesforce package in your Prodly control environment.

These APIs mimic and act as proxy for the the core services REST API as documented in Swagger. They just add the API key header when invoking the Prodly API.

/apexrest/PDRI/v1/instances/{instanceId}/checkin

/apexrest/PDRI/v1/instances/{instanceId}/checkout

/apexrest/PDRI/v1/instances/{instanceId}/deploy

/apexrest/PDRI/v1/instances

/apexrest/PDRI/v1/jobs

/apexrest/PDRI/v1/comparisons

Usage 

The Apex REST service allows you to invoke many Prodly supported actions from applications external to Salesforce, such as a continuous delivery or release management system. For example:

  • You are running CircleCI and after deploying updated code to a QA sandbox, you need to automatically deploy the updated data to the sandbox for end-to-end testing.
  • You have a custom built solution coordinating CPQ deployments that performs automated steps to promote product catalog changes between development, QA, and UAT sandboxes.

Namespace 

PDRI

The REST Endpoints 

These APIs mimic and act as proxy for the core services REST API as documented in Swagger.

  • /apexrest/PDRI/v1/instances/{instanceId}/checkin – saves data from a Salesforce environment to a version control system (VCS) repository branch.
  • /apexrest/PDRI/v1/instances/{instanceId}/checkout – deploys data from a VCS repository branch to a Salesforce environment.
  • /apexrest/PDRI/v1/instances/{instanceId}/deploy – deploys data from one Salesforce environment to another Salesforce environment.
  • /apexrest/PDRI/v1/instances – authorizes a Salesforce environment for use by the APIs.
  • /apexrest/PDRI/v1/jobs – retrieves the history of deployments.
  • /apexrest/PDRI/v1/comparisons – compares metadata with the provided instances.

Refer to our Swagger page for details. Related Salesforce Documentation.

Global Apex Services  

Usage 

AppOpsGlobalServices class that provides a global Apex that allows you to deploy metadata, deployment plans, and data sets.

Namespace 

PDRI

Service Methods

Provides wrappers to deploy data and metadata, and also to list managed instances.

The AppOpsGlobalServices class provides these methods:





global with sharing class AppOpsGlobalService {
  global static PDRI.AppOpsWebServices.Jobs deploy(PDRI.AppOpsWebServices.DeploymentServiceRequestV1 deploymentServiceRequest, 
    String destinationManagedInstanceId);

  global static List<PDRI.AppOpsWebServices.Jobs> deploy(PDRI.AppOpsWebServices.DeploymentServiceRequestV1 deploymentServiceRequest, 
    List<String> destinationManagedInstanceIds);
    
  global static PDRI.AppOpsWebServices.Jobs deploy(String deploymentName,
    String deploymentNotes,
    String sourceOrgId,
    String destinationOrgId,
    String dataSetId,
    String deploymentPlanId);
    
  global static List<PDRI.AppOpsWebServices.Jobs> deploy(String deploymentName,
    String deploymentNotes,
    String sourceOrgId,
    List<String> destinationOrgIds,
    String dataSetId,
    String deploymentPlanId);
  
  global static PDRI.AppOpsWebServices.ManagedInstances listInstances();
}

Sample Code

Example code which lists all environments in Prodly in order to find the source and destination environments based on org IDs. It then kicks off a deployment of a data set.

//Retrieve managed instances
PDRI.AppOpsWebServices.ManagedInstances managedInstances = 
    PDRI.AppOpsGlobalService.listInstances();

//Find environment ID by org ID
Id sourceOrgId = '00D4x000001989NEAQ', 
    destinationOrgId = '00D020000008kmIEAQ';

PDRI.AppOpsWebServices.ManagedInstance sourceInstance,
    destinationInstance;

for( PDRI.AppOpsWebServices.ManagedInstance instance : managedInstances.instances ) {
    if( instance.platformInstanceId == sourceOrgId ) {
        sourceInstance = instance;
    } else if( instance.platformInstanceId == destinationOrgId ) {
        destinationInstance = instance;
    }
}

//Deploy data set from control to a sandbox
Id dataSetId = 'a054x00000685c3AAA';

PDRI.AppOpsWebServices.DeploymentServiceRequestV1 deploymentServiceRequest = 
    new PDRI.AppOpsWebServices.DeploymentServiceRequestV1();

deploymentServiceRequest.deploymentName = 'My Deployment Name';
deploymentServiceRequest.deploymentNotes = 'Just a test deployment';
deploymentServiceRequest.source = 
    new PDRI.AppOpsWebServices.DeploymentSource( sourceInstance.Id );
deploymentServiceRequest.data =
    new List<PDRI.AppOpsWebServices.DataDeploymentRequest> 
	{ new PDRI.AppOpsWebServices.DataDeploymentRequest(dataSetId) };
deploymentServiceRequest.metadata =
    new PDRI.AppOpsWebServices.MetadataDeploymentRequest();

String destinationManagedInstanceId = destinationInstance.id;

PDRI.AppOpsGlobalService.deploy(deploymentServiceRequest, destinationManagedInstanceId);

Example code which kicks off a deployment of a deployment plan to multiple destinations identified by org ID’s.

String deploymentPlanId = 'a054x0000068OSUAA2';
String sourceOrgId = '00D4x000001989NEAQ';
List<String> destinationOrgIds = 
  new List<String>{'00D010000008qhjEAA','00D4C000000104dUAA'};

PDRI.AppOpsGlobalService.deploy('My Deployment Name', 'Just a test deployment', 
  sourceOrgId,
  destinationOrgIds,
  null,
  deploymentPlanId);