How to manipulate and submit data through GET and POST? [closed]

0

I have a web application and need to access an external url that has login and password. Subsequently I must fill out a form, submit the data and receive the return on my application!

Is it possible to use HTTP web requests from C # (GET, POST)?

    
asked by anonymous 04.10.2018 / 14:54

1 answer

2

Communication between web applications is actually through HTTP, it is possible to do this communication through the verbs (also known as methods) GET and POST.

In C # I use a pretty cool framework called Flurl, the link to access it is this . The site has extensive documentation on how to use it for various purposes.

For your case, the login and password will possibly be sent by a POST request, which can be sent by JSON.

await "http://site.com.br".PostJsonAsync(new { login = "blabla", senha = "teste" });

Recovering the resource through GET is simpler still.

var response = await "http://site.com.br".GetJsonAsync();

In the above case you get an object dynamically, however you can define the strongly typed mapping for some specific class.

SuaClasse obj = await "http://site.com.br".GetJsonAsync<SuaClasse>();

I use enough to consume RESTFUL APIs and in my opinion is very practical.

I hope I have helped! :)

    
04.10.2018 / 15:25