4

I am new to StackApps. I have created an account and I have got an API key.

Now my question is, how can I access user accounts? I'm interested in posted questions and answers. Is there a way to post a question or answer programmatically?

A C# .net example would be preferable.

2 Answers 2

4

You may not post data to the api but retrieving data in c# is quite simple.

  • Create a project and get an api key. To get started, just make use your project's name, whatever it is and your profile url as the app's website. This information can be modified at any time in the future.
  • Download the source code for Soapi.CS
  • Either build or add a project reference to Soapi.net35 or Soapi.net40 to your project

and from there, it is quite simple

var context = new ApiContext(apiKey).Initialize(false);

var site = context.find("http://stackapps.com");

var skysQuestions = site.Users.ById(14).Questions.ToList();

foreach (Question in skysQuestions)
{
  Console.WriteLine(Question.Title);
}
3
  • So how would one of my users actually submit a question?
    – user4948
    Feb 14, 2011 at 0:12
  • @user: They would have to do it through the site itself. Jun 28, 2011 at 1:05
  • i added soad.dll as reference but i cant get Question as the Key word .. where did i go wrong
    – user1542
    Mar 9, 2012 at 16:36
5

The current version of the API is read only, meaning you can not have users login and post answers/comments/questions. Theres documentation on the API, which you can get by click on the API documentation and help just here on the right column >>>>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .