• Ariel Siler 6
  • NEWBIE
  • 14 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have an anonymous site to make unauthenticated rest requests that activates my apex class method;
everything was worked fine when i called the following endpoint:
https://MySiteName.eu6.force.com/services/apexrest/MyEndpointName
And it activated the following apex:
@RestResource(urlMapping='/')
global with sharing class MyEndpointName {
    @httpGet
    global static Integer xxx() { ... }
But after moving the class into a new managed package the endpoint stopped working.
All the documentation talking about apex rest in managed packaged didn't talk about how it affects the url on anonymous requests made to a site.
they all sort of say to add the namespace prefix as the beginning sub domain like this:
https://MyNamespace.eu6.force.com/services/apexrest/MyEndpointName
or to add it before the endpoint name like this:
https://eu6.force.com/services/apexrest/MyNamespace/MyEndpointName
but none of them talks about how to handle sites like my case.
I tried all possible variations i could think of like:
https://MyNamespace.MySiteName.eu6.force.com/services/apexrest/MyEndpointName
https://MySiteName.eu6.force.com/services/apexrest/MyNamespace/MyEndpointName
and more adding the __ but none worked.

Eventually i got it working by adding a wildcard (*) to my urlMapping like this:
@RestResource(urlMapping='/*')
global with sharing class MyEndpointName {
    @httpGet
    global static Integer xxx() { ... }

and then the following endpoint started working:
https://MySiteName.eu6.force.com/services/apexrest/MyNamespace/MyEndpointName

The thing is that i'm worried about that wildcard because i don't understand why it works and the possible consequences.
when i use the following endpoint:
https://MySiteName.eu6.force.com/services/apexrest/NOTMYNAMESPACE/MyEndpointName
it doesn't work which is good, but stil i prefer to put in my urlMapping something implicit that will work.

when i tried to change the urlMapping into this:
@RestResource(urlMapping='/MyNamespace')
global with sharing class MyEndpointName {
    @httpGet
    global static Integer xxx() { ... }
It didn't work for that endpoint,
i need guidance regarding DataLoader any one please suggest to complete Challenge 8
 
Hi All,

I Want to give Some Validation to File Extemsion...So that it should accept particular file Format.....

i have Written these
 function check(obj) { 
            var path = obj.value;
            var ext = path.substring(path.lastIndexOf('.') + 1);
            if(ext !="pdf")
            {
                obj.value = null;
                window.alert("File can be only of type : pdf, doc, docx, xls, xlsx, ppt, pptx, pps, ppsx ");
                return false;
            }
     }
but its not Working..i want to give validation for 5-6 file Format...how it will be Written,, Kindly Suggest.