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
colingcoling 

Can a rendered Visualforce page be accessed via the API?

Hi All,

I would like to access a rendered Visualforce page via the API. Which API version will allow this? Any chance for PHP?

Colin Goldberg


Message Edited by dchasman on 11-09-2007 07:24 PM

dchasmandchasman
There are a few ways you could go about this but I first wanted to understand why a plain old HTTP GET from PHP won't work for your situation? Using PageReference.getContent() from an apex code web service method would work but would also add a bunch of layers and reduced performance compared to a direct GET of the page...
colingcoling
What context are you assuming? To access a page using GET, wouldn't you have to be logged in? This is a different model from, say, a process running on an external server and logging in through the API.

CG

dchasmandchasman
Was not assuming any specific context - that is why I asked for more info about your specific situation. If what you have is an api session ID then you do not have much choice bu to wrap your page request in an api request via an apex class webservice method, something like this should work:

global class GetMyPageWebService {
webservice static String getContent() {
PageReference p = Page.ThePageIWantContentFor;

// Add in any query params you might want to chain through here

return p.getContent();
}
}



Message Edited by dchasman on 11-12-2007 08:08 AM

colingcoling
My apologies. I take back the question - I was a little hasty.

Thanks for the example. Could you elaborate on it? My context - that I am aiming at - is in a session using the partner api. How would I call the web service (GetMyPageWebService)? I don't think I have any support in the PHP Toolkit 1.1 (latest?)


Colin Goldberg