RestResource Annotation. The @RestResource annotation is used at the class level and enables you to expose an Apex class as a REST resource. … A URL mapping for my_url will only match a REST resource containing my_url and not My_Url . To use this annotation, your Apex class must be defined as global.