You need to sign in to do that
Don't have an account?
The Ajay Gupta
Apex Rest Webservice is not working as documented in Force.com Apex Code Developer's Guide V34.0
Ihave two Apex Rest Webservice Rest1 & Rest2.
Rest1 webservice Apex class has annotation @RestResource(urlMapping='/ApexRest')
Rest2 webservice Apex class has annotation @RestResource(urlMapping='/ApexRest/*') which is saved last.
But when I tried to call the Apex Rest webservice using url url/service/apexrest/ApexRest it calls Rest1 not Rest 2 which is last saved. So I am getting confused, Is salesforce documentation is right?
An extract from Page No: 255 Force.com Apex Code Developer's Guide V34.0 summer'15 documentation:
The URL patterns URLpattern and URLpattern /* match the same URL. If one class has a urlMapping of URLpattern and another class has a urlMapping of URLpattern /*, a REST request for this URL pattern resolves to the class that was saved last.
StackExchange Question Link : Link (http://salesforce.stackexchange.com/questions/83942/apex-rest-webservice-is-not-working-as-documented-in-force-com-apex-code-develop)
Rest1 webservice Apex class has annotation @RestResource(urlMapping='/ApexRest')
Rest2 webservice Apex class has annotation @RestResource(urlMapping='/ApexRest/*') which is saved last.
But when I tried to call the Apex Rest webservice using url url/service/apexrest/ApexRest it calls Rest1 not Rest 2 which is last saved. So I am getting confused, Is salesforce documentation is right?
An extract from Page No: 255 Force.com Apex Code Developer's Guide V34.0 summer'15 documentation:
The URL patterns URLpattern and URLpattern /* match the same URL. If one class has a urlMapping of URLpattern and another class has a urlMapping of URLpattern /*, a REST request for this URL pattern resolves to the class that was saved last.
StackExchange Question Link : Link (http://salesforce.stackexchange.com/questions/83942/apex-rest-webservice-is-not-working-as-documented-in-force-com-apex-code-develop)
pcon
I believe in order for that to occur, your Rest1 urlMapping would have to be '/ApexRest/' otherwise the regex that is being applied to the URI would not match both. If they are saying they match i the documentation, then the documentation is wrong.