Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAaron Selonke
10,323 PointsGET vs POST
I noticed that the Bing News API uses a GET request with a API key header. To send the info up we use the WebClient.DownloadData() method.
and the Bing Text Analytics API uses a POST request to send up a few different Headers and a Payload containing Json Serialized Request object. In the code we use the WebClient.UploadData() method.
The MSDN docs are sometimes rough around the edges, so I'm not sure why we use one vs the other method. Do we use UploadData for POST and DownloadData for GET??
Set me straight =) Thanks
2 Answers
Radosław Olszewski
21,475 PointsWe rather use GET to download and POST to upload. Post is safer method, parameters and data are not displayed in URL and are not stored in browser history or web logs. I think GET can send data but in URL which is easier to sniff and read by 3rd party. POST IS sending data in request payload.
Avan Sharma
7,652 PointsPOST is secured. While sending data via GET adds the data in the url which can be easily interpreted and manipulated. Generally, Login pages, Credit card transaction pages have sensitive information . So POST methods are used to submit page for processing. POST requests do not remain in browser history.
GET requests remains in browser history.
Radosław Olszewski
21,475 PointsRadosław Olszewski
21,475 PointsI do not know this API so a can not answer more specific, sorry.