13

In apex you can create your own REST services quite simply:

@RestResource(urlMapping='/DUMMY/v1/*')
global class REST_Service {
@HttpGet
    global static string getDummytMessage(){
        return 'DUMMY DATA';
    }
}

Salesforce does not allow such a class to be annotated as @ReadOnly, I would like to understand and know why this is the case.

update: potentially there is no technical reason and its just not there out of a project management perspective. I've created an idea to put it on the radar.

1
  • 1
    It looks like Salesforce implemented support for the @ReadOnly annotation in Summer '20 (API Version 49). Nice!
    – BrianS
    Commented Sep 10, 2020 at 1:43

1 Answer 1

11

Thats a good question, and a reasonable one given that it is supported for Web Services defined via Apex. As to the reason for this, given both contexts are functionally the same from our perspective as developers. I am at a loss as to provide a reasonable hypothesis outside of knowning the code base of the platform.

I would suggest raising an IdeaExchange for it (had a quick check and could not see one) and perhaps raising a support case to enquiry as to if this is at all on the immediate radar to release this support.

4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .