function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RadnipRadnip 

List of limitations of Salesforce sites? Is HttpRequest() permitted?

Firstly I'm trying to find out if you can do an HttpRequest using Salesforce sites my code is:

 

        Http h = new Http();
        HttpRequest req = new HttpRequest();
    	req.setEndpoint('http://website.net/test.php?e=teststs');
    	req.setMethod('GET');
    	h.send(req);

 But I keep getting "Authorisation Required" appearing... do I need to set some other permissions?

 

Also is there a list of things you can't do with Salesforce Sites?

 

Thanks

 

Francis

nssfdcnssfdc

You would have to register the site you are trying to access in the remote site setting - see this article http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts

RadnipRadnip
I had already done that and it still didn't work.
Andy BoettcherAndy Boettcher

Hit the "Preview as Admin" link from the Sites page to launch your Site with the ability to see errors.  Odds are there is something off in your code that is throwing an exception.

 

-Andy

RadnipRadnip

I can't use Preview as Admin as based on your permissions different information is displayed and the error doesn't occur running as admin.

Andy BoettcherAndy Boettcher

If you don't get the error as admin, the first thing I'd check is to see if you are referencing objects that you haven't assigned proper "Public Access Settings" to.