Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Performing branch operations by using REST APIs

Updated on September 10, 2021

You can use the branches REST and merge REST services in your automation server such as Jenkins to perform branch operations. By using these services to detect conflicts, merge branches, and create branch reviews, your organization can quickly deliver high-quality software.

Configuring data transforms in Pega Platform

You must first configure data transforms in Pega Platform™ to specify information that is required to use the REST services, for example, the application name and version that you want to use for conflict detection and merging.

  1. Specify the application name and version that you want to use for conflict detection and merging:
    1. Search for the pySetApplicationDefaults data transform.
    2. Save the data transform to the ruleset in your development application that contains the continuous integration rules.
    3. In the Source field for the Param.ApplicationName parameter, enter the name of the application that you want to use for conflict detection and merging.
    4. In the Source field for the Param.ApplicationVersion parameter, enter the application version.
    5. Save the rule form.
  2. Optional: Set the target ruleset version that you want to use for conflict detection and merging. If you do not perform this step, a new ruleset version is created into which rules are merged. Complete the following steps:
    1. Search for the pySetVersionDefaults data transform.
    2. Save the data transform to the ruleset in your development application that contains the continuous integration rules.
    3. In the Source field for the pyTargetRuleSetVersionparameter, enter the ruleset version into which you want to merge.
    4. Save the rule form.
  3. Optional: Set passwords that are needed during merge operations. As a best practice, you lock these rulesets with a password. Complete the following steps:
    1. Search for the pySetVersionPasswordDefaults data transform.
    2. Save the data transform to the ruleset in your development application that contains the continuous integration rules.
    3. Specify the passwords that are required for merging.
    4. Save the rule form.
  4. Configure your automation tool, such as Jenkins, to use the branches REST and merge REST services in to perform branch operations such as detecting conflicts and merging branches.

REST services for branch operations

After you configure the required data transforms in Pega Platform, you can use the branches REST and merges REST services in an automation server such as Jenkins. These services detect potential conflicts before a merge, merge rules in a branch, obtain the status of the merge, and create branch reviews.

To access the documentation about the data model, click Resources > Pega API.

Branches REST service

You can use the branches REST service to retrieve a list of conflicts before you run tests and merge branches.

Conflicts subresource

You can use the conflicts subresource to retrieve a list of conflicts before running tests, allowing the pipeline to fail more quickly so that you can correct errors faster.

  • Request – http://serverURL/prweb/api/v1/branches/{id}/conflicts
  • Parameter – ID. The name of the branch for which you want to receive conflicts. This parameter is required.
  • Response – The conflicts subresource returns the number of conflicts.

Merge subresource

Use the merge subresource to perform additional tests on conflicts, and then perform a merge operation.

  • Request – http://serverURL/prweb/api/v1/branches/{id}/merge
  • Parameter – ID. The name of the branch that you want to merge. This parameter is required.
  • Response – The merge subresource returns a unique ID after a validation event occurs. During the merge, the status is saved to an instance of the System-Queue-Merge class.

To verify the status of a merge, use the Merges REST service, using the ID returned by the response.

You can also use the Queue Management landing page to view information about and remove merge requests without needing to know the response ID. Open the landing page by clicking Designer Studio > System > Operations > Queue Management.

You can also update logging levels to INFO on the pzMergeServicePostActionProcessing activity to log informational messages. These messages can provide information about why exceptions are occurring and also act as a reference that you can use if you are working with Global Customer Support. For more information about logging levels, see Logging Level Settings tool.

Review subresource

Use the review subresource to create a branch review.

  • Request – http://serverURL/prweb/api/v1/branches/{id}/review
  • Parameter – ID. The name of the branch for which you want to create a review. This parameter is required.
  • Request body – The email account of the user creating the review and the users who are reviewing the branches. Use the following format:

{

"author": "<your_userid>",

"description": "<description of the review>",

"reviewers": [

{

"ID": "reviewer_userid"

}

]

}

  • Response – The review subresource returns the ID of the branch review.

Merges REST service

Use the merges REST service to obtain the status of the merge that you created by using the merge subresource.

  • Request – http://serverURL/prweb/api/v1/merges/{ID}
  • Parameter – ID. The unique identifier that you obtained by running the merge subresource of the branches REST service. This parameter is required.
  • Response – The merges REST service returns the status from the System-Queue-Merge instance.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us