0

I am exposing a Apex class through rest API to outside world. Since this is going to basic API no need for authentication and security so implementing through Sites. I am just starting with basic code now

and my apex class code is below

@RestResource(urlMapping='/Attachfiles')
global class AttachmentService {
    @HttpGet
    global static String doGet() {
        String name = RestContext.request.params.get('name');
        return 'Hello '+name;
    }
}

The name of the site I gave is "WS" so went into the "Public access settings" of that WS guest user profile and gave access for that apex class also

enter image description here

but when i try to hit the service I always getting forbidden

enter image description here

1
  • You're hitting that through PostMan, but how do you know you're in the context of that profile? I would imagine unless you hit the endpoint through that site it's not going to see you as having the WS Profile. Jan 3 at 12:57

0

Your Answer

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

Browse other questions tagged or ask your own question.