Activity Forums Salesforce® Discussions What is urlMapping in RestResource class?

  • Prachi

    Member
    August 22, 2019 at 11:01 am

    Hi,

    The @RestResource annotation is used at the classlevel and enables you to expose an Apex class as a REST resource. These are some considerations when using this annotation: The URL mapping is relative to https:// instance .salesforce.com/services/apexrest/.The URL mapping is case-sensitive. A URL mapping for my_url will only match a REST resource containing my_url and not My_Url.

    URL Guidelines-

    URL path mappings are as follows:

    1. The path must begin with a '/'.
    2. If an '*' appears, it must be preceded by '/' and followed by '/', unless the '*' is the last character, in which case it need not be followed by '/'.

    The rules for mapping URLs are:

    1.An exact match always wins.
    2.If no exact match is found, find all the patterns with wildcards that match, and then select the longest (by string length) of those.
    3.If no wildcard match is found, an HTTP response status code 404 is returned.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos