3
Good afternoon.
I would like to know how to work with github API in ASP.NET. I’ve never worked with Apis before.
P.S. I cannot use octokit
Can someone help me? Thank you
3
Good afternoon.
I would like to know how to work with github API in ASP.NET. I’ve never worked with Apis before.
P.S. I cannot use octokit
Can someone help me? Thank you
2
Use normal HTTP requests to access the API by reading the return JSON data.
The Github API is an API RESTful
, which basically means that your data is accessible by common HTTP requests, without using extra protocols to read them (such as SOAP
). A REST API is based on the correct use of the HTTP protocol, using its methods for what was actually created:
GET
- catch content of the APIPOST
- introduce content in the APIPUT
- upgrade content in the APIDELETE
- remove content of the APIThe REST specification also introduced the term resource, which is nothing more than what the API exposes (users, Repos, etc.) and the best use of Uris (Uniform Resource Identifier), to identify specific resources (Urls are Uris).
I’m not gonna give you the answer. Since you’re participating in a selection process (and other people fall for that answer in the same situation), that wouldn’t be fair; I’ll just explain how it works, what to do, but no code.
As I said, REST Apis can be consumed through normal HTTP requests (like you do from your browser to access any web page). So you can use the class Httprequest to consume the API. By changing the URL and request method you can do everything you need to extract data from the API.
Once you get the data, you’ll get a string, that’s a JSON. It is a way of representing data (an instance of a class with all its properties, for example) by string, for a simpler data exchange. To turn this JSON into something you can use, you can use the library JSON.NET (ancient Newtonsoft.Json
), to turn it into a normal C# object.
That’s basically it! Then you’ll have everything you need. Research on these guys who have a lot of tutorial over the internet. In case you don’t understand anything, just say the word.
Browser other questions tagged c# asp.net api github
You are not signed in. Login or sign up in order to post.
Why can’t you use Octokit? It’s the main API.
– Leonel Sanches da Silva
It’s a selection so I can’t use Octokit. I should only use the Open Api (REST)
– Marcelo
What is a "selection"? We’re talking about this API?
– Leonel Sanches da Silva
No, sorry I confused.. I can’t use it because I’m participating in a developer selection.
– Marcelo
You are participating in a selection process. I think I went through the same as yours! Haha - I will see if I answer by giving only the path of stones...
– danguilherme