Bassam
Bassam

Reputation: 856

How i can to make a new public rest api with apex classes

How i can to make a new public rest api with apex classes, to return JSON from salesforce.

i make apex classes, but i can't know how to make url ( i see https://www.youtube.com/watch?v=A-nzywBLUbM ) but this old and not all steps found ).

@RestResource(urlMapping='/myService')
global class MyService {
    @HttpGet
    global static String doGet() {
        return 'Hello';
    }
}

Thanks.

Upvotes: 0

Views: 380

Answers (1)

Matt Kaufman
Matt Kaufman

Reputation: 808

You need to expose the Web Service via a Force.com Site and then ensure that the Site User's profile has access to the Apex Class. Exposing Apex Rest Web Services

Upvotes: 1

Related Questions