3

Is there a way to check if being run in RestResource Context? I have a script that posts messages to an endpoint but we can end up in an infinite loop scenario as they are now posting their comments to us. How can I check for this flag or flag this during runtime?

Ideally something like:

Test.isRunningTest()

1 Answer 1

9

You can check if you're in a REST call via:

Request.getCurrent().getQuiddity() == Quiddity.REST

You can read more about the Request object, as well as the possible values for Quiddity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.