开发者

Paypal nvp api - Post request not working

I've been reading through the API and looking at samples and they seem to use POST to send their request. When I tried using POST I kept getting back a 10001 error. When I switched the request method to GET it works.

I was using the following code for Posting the request - FAILS

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
        req.Method = "Post";
        req.ContentType = "application/x-www-form-urlencoded";
        WebResponse response = req.GetResponse();

I use the exact same code for using GET, except for method type - WORKS

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
        req.Method = "Get";
        req.ContentType = "application/x-www-form-urlencoded";
        WebResponse response = req.GetResponse();

Can I use GET for making API requests? The reason I ask is because every single example on the net uses POST, and it is used in their API examples as well. Is开发者_JAVA技巧 there some sort of security risk of using GET even though it is sent to an ssl link?

Lastly, why is the POST request sending back an invalid response?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜