Global API

Updated 6 days ago by Copado Solutions

Overview

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 licenses Information:
    • Will 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: String upsertCopadoLicense(Id userId, copado.GlobalAPI.UserLicense licenseDetails)
    • 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 licenses assignments per user.
    • Signature:List listCopadoLicenses()
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(); System.debug(copadoGlobalAPI.getLicenseInformation()); System.debug(copadoGlobalAPI.listCopadoLicenses()[0]);
Id userId = Id.valueOf(copadoGlobalAPI.listCopadoLicenses()[0].userId);
copado.GlobalAPI.UserLicense UL = new copado.GlobalAPI.UserLicense(UserId,False,False,False,False,False);
copadoGlobalAPI.upsertCopadoLicense(userId,UL);
System.debug(copadoGlobalAPI.listCopadoLicenses()[0]);
UL.isCADEnabled=false;
UL.isCCHEnabled=false;
UL.isCCMEnabled=true;
UL.isCopadoEnabled=true;
UL.isCSTEnabled =true;
copadoGlobalAPI.upsertCopadoLicense(userID,UL);
System.debug(copadoGlobalAPI.listCopadoLicenses()[0]);

Sample Apex Anonymous Global API Call (New Version)

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.isCADEnabled=false;
UL.isCCHEnabled=false;
UL.isCCMEnabled=true;
UL.isCopadoEnabled=true;
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
System.debug(result);


How did we do?