Skip to main content
3 of 3
Commonmark migration

Soapi.CS - Full Parameter Parity

Soapi provides full API coverage including parameters.

[Test]
public void info_param()
{
    // /questions
    SO.Questions
        // answers (optional)   When "true", the answers to a question will be returned
        .WithAnswers(true)
        // body (optional)      When "true", a post's body will be included in the response.
        .WithBody(true)
        // comments (optional)  When "true", any comments on a post will be included in the response.
        .WithComments(true)
        // fromdate (optional)  Unix timestamp of the minimum creation date on a returned item.
        .FromDate("january 1, 2001") // can parse dates
        // max (optional)       Maximum of the range to include in the response according to the current sort.
        .Max(2)
        // min (optional)       Minimum of the range to include in the response according to the current sort.
        .Min(1)
        // order (optional)     How the current sort should be ordered.
        .Order(SortOrder.Asc)
        // page (optional)      The pagination offset for the current collection. Affected by the specified pagesize.
        .Page(1)
        // pagesize (optional)  The number of collection results to display during pagination. Should be between 1 and 100 inclusive.
        .PageSize(100)
        // sort (optional)      How a collection should be sorted.
        .Sort(QuestionSort.Votes)
        // tagged (optional)    Semicolon delimited list of tags questions must have
        .Tagged("a", "b") // accepts param aary
        // todate (optional)    Unix timestamp of the maximum creation date on a returned item.
        .ToDate(new DateTime(2020, 1, 1))

        .PageCount(10) // fetch multiple pages .PageCount(-1) to get all pages
        .ToList();
}

Request that is issued: (bogus request, so no paging occurs)

http://api.stackoverflow.com/1.0/questions?answers=true&body=true&comments=true&fromdate=978307200&max=2&min=1&order=Asc&page=1&pagesize=100&sort=Votes&tagged=a;b&todate=1577836800

Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60