To use the Reddit API to get a list of all comments in a thread in C#, you will need to follow these steps:
HttpClient
class to make HTTP requests to the Reddit API.main.cs35 chars2 lines
Authorization
header with your access token for authentication as well as the user agent string to identify your application.main.cs370 chars6 lines
Newtonsoft.Json
to convert the response body into a list of comments.main.cs263 chars7 lines
main.cs188 chars6 lines
Note: In order to deserialize the JSON response into a Comment
object, you will need to create a Comment
class with properties for each data point you want to access. For example:
main.cs220 chars9 lines
gistlibby LogSnag