+ Start a Discussion
komathipriyakomathipriya 

Rest API class in salesforce site not obeying the object permissions

Hi ,
I created a Salesforce site , to make a rest api call from out side website. Even if stop the object permission my rest api class can create records to the objects. Where as my normal class not allowing to create records in the object with out permission. Also i try to set field level permissions.
How to make the rest api class to obey the object permissions ?
Below is the code i used

@RestResource(urlMapping='/myservice')
global with sharing class MyService
 {          
       @HttpPost    
        global static void doPost() 
        {
            I will get the Json string from other site and insert into my custome object.
            If i remove the permission of the object it should not create records.
        }
}
 
ShashankShashank (Salesforce Developers) 
Please ensure that you are setting the permissions in the public access settings of the site.