+ Start a Discussion
Force.comForce.com 

Read POST request in Apex

Hi All,

 

To read the GET parameters from the URL, we use:
ApexPages.currentPage().getParameters().get(<name>);

How can I read POST parameters from the URL ?

 

Thanks,
Pragati

Best Answer chosen by Admin (Salesforce Developers) 
Abhay AroraAbhay Arora

Hi,

 

I think you missunderstood what i said what i meant was if you put your parameters in url they can be handeled by get you can use post also below are the details

 

 

http://boards.developerforce.com/t5/Visualforce-Development/Re-Get-POST-data-via-visualforce-page/td-p/104987

All Answers

Abhay AroraAbhay Arora

If  you send parameters with URL they can be accessed by GET method only this is basic way of working of forms.

Force.comForce.com

Hi Abhay,

 

Thanks for the quick response.

Is it mentioned somewhere in the salesforce documentation that Apex can only read GET parameters ?

 

Abhay AroraAbhay Arora

Hi,

 

I think you missunderstood what i said what i meant was if you put your parameters in url they can be handeled by get you can use post also below are the details

 

 

http://boards.developerforce.com/t5/Visualforce-Development/Re-Get-POST-data-via-visualforce-page/td-p/104987

This was selected as the best answer
Force.comForce.com

Hi Abhay,

 

Thanks for helping me out.

Now I understood that for reading parameters sent through GET or POST mechanism, we use the same code i.e ApexPages.currentPage().getParameters().get(<param name>);

 

But my client reported the issue that if he sends the request through GET instead of POST, system works fine. He would like to have the functionality working in POST call as well.

 

What could be the cause for this, any suggestions or ideas ?

 

Thanks,

Pragati

Abhay AroraAbhay Arora

Do you have any example for post call ?

Force.comForce.com

I dont have it right now. I will talk to my client for that.

Thanks a lot

 

Pragati

Kuldeep Rathore 7Kuldeep Rathore 7
Hi Team,

I have exposed my site page to external service which is make a POST request to my site page. I am able to get header and parameter values, how come I can get the body ?

Thanks in Advance,
Kuldeep