6

Rest API parameter are case-sensitive, Like User_Id and user_id are not interchangeable. But are services URLs also case-sensitive?

2 Answers 2

5

As per salesforce documentation:

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.

Also if you are packaging your REST Service in a managed package your package namespace prefix is also case-sensitive.

The URL for a namespaced classes contains the namespace. For example, if your class is in namespace abc and the class is mapped to your_url, then the API URL is modified as follows: https://instance.salesforce.com/services/apexrest/abc/your_url/. In the case of a URL collision, the namespaced class is always used.

In above example if your namespace is abc you can't use ABC, Abc or any other variation of upper/lower case namespace.

1

I agree to Amit and its true about custom API.

But for standard API the URI are case insensitive. (except the id part)

For ex: send request to any of following uri and it still returns valid result

  • /services/data/v35.0/sobjects/Account/0019000001AWn2oAAD
  • /services/data/v35.0/sobjects/AccOunt/0019000001AWn2oAAD
  • /services/data/v35.0/sobjects/ACCOUNT/0019000001AWn2oAAD

But if you try with case insensitive ID it will not work. for ex.

  • /services/data/v35.0/sobjects/Account/0019000001AWn2oAAd
  • /services/data/v35.0/sobjects/AccOunt/0019000001aWn2oAAD
  • /services/data/v35.0/sobjects/ACCOUNT/0019000001AWN2o

PS: for this simple test i used workbench but you can use any client and it should work

5
  • Sort of. If you mess up the case of an ID, salesforce tends to complain about it.
    – sfdcfox
    Jul 5, 2016 at 16:35
  • not for ids with length 18 Jul 5, 2016 at 17:24
  • 1
    Yes, even with IDs length 18. You'll get a MALFORMED_ID error if you change any single character's case in the ID. Try it out for yourself.
    – sfdcfox
    Jul 5, 2016 at 17:27
  • ok, got you point. Updated my answer. Jul 6, 2016 at 4:59
  • @sfdcfox, thank you for the comment, it was helpful. Also this leads me to new question salesforce.stackexchange.com/questions/130158/… . Please take a look at it when you get time. Thanks. Jul 6, 2016 at 6:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .