Original API

This original Prodly AppOps application programming interface (API) is officially deprecated as of January 2022 and will be removed from service on January 15, 2023. Prodly strongly recommends changing over to the new API well before the deadline.

Overview 

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

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

These API requests are available:

  • Deployment Web Service
  • Deployment Apex Service

Deployment Web Service 

Deployment Web Service is REST web service specific to Prodly AppOps that provides the ability for AppOps consumers and integrated systems outside of Salesforce to invoke deployments and perform other actions through REST-based API requests exposed by the AppOps Salesforce package in your Prodly AppOps control org.

Usage 

The Deployment Web Service allows you to deploy deployment plans and data sets from applications external to the 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 Endpoint 

The endpoint takes these parameters:

  • The destination org is the value of the targetConnectionId required parameter.
  • The source org is one of these choices:
    • The org in which you invoke the endpoint.
    • The value of the sourceConnectionId, if you supply the optional parameter. 
  • For data sets only, you can optionally pass a query filter in for the data set’s root deployment object.

There are various ways to reference the endpoint:

  • For deployment plans:
    • /dataset/deploy/plan/*
    • https://<org_instance>.salesforce.com/services/apexrest/PDRI/dataset/deploy/plan/<deployment_plan_id>?targetConnectionId=<connection_id>
    • https://<custom_domain>.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/plan/<deployment_plan_id>?targetConnectionId=<connection_id>
  • For data sets:
    • /dataset/deploy/*
    • https://<org_instance>.salesforce.com/services/apexrest/PDRI/dataset/deploy/<data_set_id>?targetConnectionId=<connection_id>&queryFilter=<URL_UTF-8_encoded_where_clause_for_root>
    • https://<custom_domain>.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/<data_set_id>?targetConnectionId=<connection_id>&queryFilter=<URL_UTF-8_encoded_where_clause_for_root> 
    • https://<custom_domain>.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/<data_set_id>?targetConnectionId=<connection_id>&queryFilter=<URL_UTF-8_encoded_where_clause_for_root> 

Sample URLs 

  • https://na8.salesforce.com/services/apexrest/PDRI/dataset/deploy/a000H00400s6WikQAE?targetConnectionId=a030H00120XIWDzQAP
  • https://prodlytest-dev-ed.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/a000H00400s6WikQAE?targetConnectionId=a030H00120XIWDzQAP&sourceConnectionId=a007J023445TIJddPRK 
  • https://prodlytest-dev-ed.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/a000H00400s6WikQAE?targetConnectionId=a030H00120XIWDzQAP&queryFilter=Name%20LIKE%20%27A%25%27%20AND%20MailingState%3D%27California%27

Sample Command Line Interface (CLI) Code 

Code Format 

$ curl -H “Authorization: Bearer <session_id>” “<endpoint>

Code Sample 

$ curl -H “Authorization: Bearer BBASDQMFfAfpRjOw4dE5c1p0vzbeV98wgl460GrL3eOLfghnSpfFeoeqb.HH0XurSpXjCeHAjZZJioJ1magcmixMxpED6xe0n” “https://prodlytest-dev-ed.my.salesforce.com/services/apexrest/PDRI/dataset/deploy/a000H00400s6WikQAE?targetConnectionId=a030H00120XIWDzQAP”

JSON Response 

{
“resultIds”:null,”resultId”:”a040H0000168iXcQAI”,”error”:null
}

Related Salesforce Documentation 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest.htm

Deployment Apex Service 

The DeploymentService class is an Apex service specific to Prodly AppOps.

Usage 

The DeploymentService class allows you to deploy deployment plans and data sets using the Apex API. Depending on the parameters you specify, the API request deploys data from your control org or a source org you specify to one or more destination orgs.

Namespace 

PDRI

Methods 

The DeploymentPlanService class provides these methods for deployment plans:

  • ID deploy(deploymentPlanId, targetConnectionId) – Deploys the given deployment plan, copying data from the control org to the given destination org.
  • ID deploy(deploymentPlanId, sourceConnectionId, targetConnectionId) – Deploys the given deployment plan, copying data from the given source org to the given destination org.
  • List<ID> deploy(deploymentPlanId, targetConnectionIds) – Deploys the given deployment plan, copying data from the control org to the given list of destination orgs.
  • List<ID> deploy(deploymentPlanId, sourceConnectionId, targetConnectionIds) – Deploys the given deployment plan, copying data from the given source org to the given list of destination orgs.
  • List<ID> deploy(rootDataSetId, sourceConnectionId, targetConnectionIds, queryFilters) – Deploys the given deployment plan, copying data from the given source org to the given list of destination orgs, filtering records for objects with given filters.

The DeploymentService class provides these methods for data sets:

  • ID deploy(rootDataSetId, targetConnectionId) – Deploys the given data set, copying data from the control org to the given destination org.
  • ID deploy(rootDataSetId, sourceConnectionId, targetConnectionId) – Deploys the given data set, copying data from the given source org to the given destination org.
  • List<ID> deploy(rootDataSetId, targetConnectionIds) – Deploys the given data set, copying data from the control org to the given list of destination orgs.
  • List<ID> deploy(rootDataSetId, sourceConnectionId, targetConnectionIds) – Deploys the given data set, copying data from the given source org to the given list of destination orgs.
  • List<ID> deploy(rootDataSetId, sourceConnectionId, targetConnectionIds, queryFilters) – Deploys the given data set, copying data from the given source org to the given list of destination orgs, filtering records for objects with given filters.

Parameters 

The deployPlan() method accepts these parameters:

  • ID deploymentPlanId – The ID of the deployment plan to deploy.
  • ID sourceConnectionId – The ID of the AppOps connection to the source org from which to deploy data.
  • ID targetConnectionId – The ID of the AppOps connection to the destination org that receives the deployed data.
  • List<ID> targetConnectionIds – A list of IDs of the AppOps connections to up to five destination orgs that receive the deployed data.
  • Map<String,String> queryFilters – A list of object API name and query filter pairs, each containing a deployment object in any data set in the deployment plan and the filter criteria to use for that object, where the filter is a URL UTF-8 encoded SOQL query WHERE clause (minus the WHERE).

The deploy() method accepts these parameters:

  • ID rootDataSetId – The ID of the data set to deploy.
  • ID sourceConnectionId – The ID of the AppOps connection to the source org from which to deploy data.
  • ID targetConnectionId – The ID of the AppOps connection to the destination org that receives the deployed data.
  • List<ID> targetConnectionIds – A list of IDs of the AppOps connections to up to five destination orgs that receive the deployed data.
  • Map<String,String> queryFilters – A list of object API name and query filter pairs, each containing a deployment object in the data set and the filter criteria to use for that object, where the filter is a URL UTF-8 encoded SOQL query WHERE clause (minus the WHERE).

Return Value 

Depending on the parameters you pass in, deployPlan() and deploy() return one of these values:

  • ID – The ID of the result record.
  • List<ID> – A list of result record IDs, one for each destination org.

Sample Code 

ID rootDataSetId = [SELECT Id from PDRI__DataSet__c where Name = ‘<data_set_name>’ LIMIT 1].Id;

ID targetConnectionId = [SELECT Id from PDRI__Connection__c where Name = ‘<connection_name>’ LIMIT 1].Id;

ID deploymentResultId = PDRI.DeploymentService.deploy(rootDataSetId, targetConnectionIds);

ID deploymentResultId = PDRI.DeploymentService.deploy(rootDataSetId, sourceConnectionId, targetConnectionIds);

queryFilters.put(‘Account’, ‘LIMIT 10’);
ID deploymentResultId = PDRI.DeploymentService.deploy(rootDataSetId, sourceConnectionId, targetConnectionIds, queryFilters);

API Error Messages 

This table lists errors the API can return.

Error CodeError KeyError Message
209INVALID_DEPLOYMENT_PLAN_IDInvalid deployment plan id <deploymentPlanId> in API request.
210INVALID_DATA_SET_IDInvalid data set id <dataSetId> in API request.
211INVALID_SOURCE_CONNECTIONInvalid source org connection id <sourceConnectionId> in API request.
212INVALID_DESTINATION_CONNECTIONInvalid destination org connection id <destinationConnectionId> in API request.
213TOO_MANY_DESTINATION_ORG_IDSToo many destination orgs. Please limit the number of destination orgs to five per deployment.