function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vo2maxvo2max 

Anonymous REST API fails to return records unless the request contains authentication

I have written an Apex REST service, that is accessed via a SFDC site and is accessed anonymously. A recent change (not sure if a user changed something or if the change was on SFDC's side) resulted in the result set returning zeros records. All the API does is perform a SOQL query and return a result. When hitting the API without authentication, I recieve a status of 200 but zero records returned. If I include authentication, I recieve a 200 with records returned.  This worked, without authentication, as of a week ago. The odd thing is that there is no security error... the response is a 200 error. The only difference between the two cases is sending the request with authentication, and the response with that authentication returns records, the others does not. 

Note, the record being queried is a 'case.'

Do you have any ideas how to configure SFDC so that a record is returned (without authentication)?
MahmudkMahmudk
Maybe the profile has changed to the account who calls the custom Rest Apex service ?
Avery Henry 2Avery Henry 2

I know this thread is three years old.  But I just solved the issue I was having with this by changing the REST controller's class from "Global with Sharing Class" to simply "Global Class".

Just wanting to post that a solution in case anyone else happens to stumble upon this thread.