Global API

Updated 8 months ago by Copado Solutions


Copado's Global API allows you to invoke methods to conveniently automate some time-consuming tasks. Global API class access, included in the Copado User permission set, is required.

From Salesforce, you may review Global API methods and their signature. In order to do so, follow these steps:

  1. Open Salesforce's Setup.
  2. Navigate to Apex Classes.
  3. Open the Global API Apex class.
  4. Review methods and signature from the Class Summary tab.

Supported Methods

  • Get Copado license Information:
    • Provide total, available, and used information for your Copado licenses.
    • Signature:copado.GlobalAPI.CopadoLicenses getLicenseInformation()
  • Upsert a license:
    • Insert or update a Copado license.
    • Signature: LicenseOperationResult upsertCopadoLicense(copado.GlobalAPI.UserLicense licenseDetails)
  • Delete a Copado license
    • Remove a Copado license
    • Signature:Boolean deleteCopadoLicense(Id userId)entation/global-api
  • List a Copado license
    • Review license assignments per user.
    • Signature:List listCopadoLicenses()
  • Get recent metadata changes from an org credential
    • Fetch the recent changes in metadata using the source member object.
    • Signature: List<copado.SourceMemberResult> getRecentChanges(String orgId)
You can review inner classes and methods by going to Setup > Apex Classes > GlobalAPI.

Sample Apex Anonymous Global API Call

copado.GlobalAPI copadoGlobalAPI = new copado.GlobalAPI();

copado.GlobalAPI.UserLicense UL = new copado.GlobalAPI.UserLicense();

// by default, all the license types belongs to the UserLicense instance will be set to false and the id will be assigned as currentUser id by the system on the above line

//after you have the instance as UL, you can now do the changes 





UL.isCSTEnabled =true;

UL.userId = {!anyIdyouwanttoAssing}

GlobalAPI.LicenseOperationResult result = copadoGlobalAPI.upsertCopadoLicense(UL);

//this operation now returns you a result with isSuccess, isCreated, isUpdated, errorString columns


Sample Apex Anonymous Global API to Leverage Refresh Recent Changes Feature

Use this code snippet to get the recent metadata changes. This doesn’t refresh the related org credential, it just retrieves the metadata modified since the last metadata refresh date of the credential.

copado.GlobalAPI copadoGlobalAPI = new copado.GlobalAPI();

//orgId is the id of Org credential record for which recent changes should be fetched

List<copado.SourceMemberResult> results = copadoGlobalAPI.getRecentChanges('orgId');


//Wrapper class "SourceMemberResult" attributes

String CreatedDate;

LookupUserField CreatedBy;

String LastModifiedDate;

LookupUserField LastModifiedBy;

String MemberName; //Metadata name

String MemberType; //Metadata type

Boolean IsNameObsolete;// Metadata is deleted


//Wrapper class "LookupUserField" attributes

String Name; //Full name of the user

How did we do?