+ Start a Discussion
David Zhu 8David Zhu 8 

USE Visualforce page as REST API endpoint

HI All,
We have a third party application which uses Visualforce page as REST API endpoint.
I checked the code and configuration and found there is NO connected app created in salesforce.

I was told that the third party application uses oauth2 to authenticate in Salesforce and sends http request to visual force page url, then reads the content of the visualforce page.
In the loggin history, I can see the login type is "other apex API".
On visualforce page, it is very simple
<apex:page contentType="text/plain; charset=UTF-8" controller="MobileIntegrationController" sidebar="false" showHeader="false" showChat="false" action="{!init}">
    {!responseString}
</apex:page>

It uses controller to generate the responseString and put as the content of the VF page.

Can someone please help me on this?

Thanks,
David
Best Answer chosen by David Zhu 8
Ashish DevAshish Dev
You have to use REST protocol.
Think Salesforce vf page URL as endpoint then simply make GET request to this endpoint and you will get response. This is same like browsers do.
I am not considering the authentication part here. You can user different authentication mechanis to authendicate at your REST client. This does not require connected app setting.

All Answers

Ashish DevAshish Dev
Could you tell us what are you trying to find?
Also did you check vf is exposed through communities?
David Zhu 8David Zhu 8
Hi Ashish,
What I am trying to find is how to send HTTP request to a Salesforce ULR (like c.cs20.visual.force.com/apex/vfpage) NOT Salesforce Site URL.withouth connected APP, then consequently, in the response, I can read the content of the VF page.
So far, I tried partner WSDL in C#, but no luck.
I am sure it is doable as our third party application is doing that but they won't tell me how to implement it.

Thanks,
David
Ashish DevAshish Dev
You have to use REST protocol.
Think Salesforce vf page URL as endpoint then simply make GET request to this endpoint and you will get response. This is same like browsers do.
I am not considering the authentication part here. You can user different authentication mechanis to authendicate at your REST client. This does not require connected app setting.
This was selected as the best answer
David Zhu 8David Zhu 8
GET works. Thanks Ashish.
Bruce_DoBruce_Do
I also have the issue with this solution, use Visualforce page as Rest API endpoint.
I can use this solution with Community Guest User, but when I try to use Authentication Bearer (login user), I also get no response from server.
If you have experience on this, please help. Thank.