Example - Update the EventRelayConfig state Field

This example shows how to change the EventRelayConfiguration state field from RUN to PAUSE with Tooling API and REST.

USER PERMISSIONS NEEDED
To create a PlatformEventChannel:Customize Application
To use REST API:API Enabled
  1. To get the ID of the event relay configuration, perform this query using a GET request.

    1. Use this URI, and replace the DeveloperName value with the appropriate value: /services/data/v57.0/tooling/query/?q=SELECT+Id,DeveloperName+FROM+EventRelayConfig+WHERE+DeveloperName='MyEventRelay'
    2. Save the returned ID. The EventRelayConfig ID is in the format 7k2XXXXXXXXXXXXXXX.
  2. To update the state field, send a PATCH request to this URI after replacing the placeholder value for the EventRelayConfig ID.

    • URI: /services/data/v57.0/tooling/sobjects/EventRelayConfig/<EventRelayConfigId>

    • Use this request body for the PATCH request, and replace the FullName value with the full name of the EventRelayConfig that you created earlier.

A successful PATCH operation returns the 204 No Content HTTP status.

You can’t update eventChannel or destinationResourceName in EventRelayConfig.

The valid values that you can use to update the State field are:

  • RUN
  • PAUSE
  • STOP

The execution state of the event relay is reflected in the EventRelayFeedback Salesforce object Status field. EventRelayFeedback also contains other execution information about the event relay. Later, you learn how to monitor the status of the event relay with EventRelayFeedback.