I'm trying to do this:
Go to Utilities - REST Explorer Select the "POST" radio button Replace the with the id from Step 4. Replace the with the id from Step 5. Fill up the form with the updated information
URL: /services/data/v51.0/tooling/sobjects/PlatformEventSubscriberConfig
Body:
{
"BatchSize": "200",
"DeveloperName":"SourceGroupAcceptanceTriggerConfig",
"MasterLabel":"SourceGroupAcceptanceTriggerConfig",
"PlatformEventConsumerId": "<trigger ID>",
"UserId": "<System User ID>"
}
Where am I doing wrong? Please help
My Class:
public class PlatformEventUpdateClass {
public static List<Id> getPlatformEventDetails() {
List<ApexTrigger> triggerId = [Select Id, Name From ApexTrigger Where Name = 'SourceGroupAcceptanceTrigger'];
System.debug('Trigger Id: ' + triggerId[0].Id);
List<User> userId = [Select Id, Name From User Where Name = 'User System'];
System.debug('User Id: ' + userId[0].Id);
//Edited by me
//changing return type to List<Id> from void
List<Id> triggerUserIdList= new List<Id>();
triggerUserIdList.add(triggerId[0].Id);
triggerUserIdList.add(userId[0].Id);
return triggerUserIdList;
}
}
This is my Anonymous Code Block:
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
req.requestURI = System.Url.getSalesforceBaseUrl().toExternalForm() + '/services/data/v51.0/tooling/sobjects/PlatformEventSubscriberConfig';
req.httpMethod = 'POST';
RestContext.request = req;
String str = 'SourceGroupAcceptanceTrigger';
req.requestBody= Blob.valueOf(str);
RestContext.response= res;
PostThrough.postt();