Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Features

Supported Frameworks

  • StacMan 0.4.0.0 or earlier: .NET 4.0
  • StacMan 1.0.0.0 or later: .NET 4.5

Get StacMan

StacMan is available on NuGet:

PM> Install-Package StacMan

Example Usage

using StackExchange.StacMan;
...
var client = new StacManClient(key: "my-app-key", version: "2.1");

Synchronous

var response = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz").Result;

foreach (var question in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Asynchronous

var task = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

task.ContinueWith(t =>
    {
        foreach (var user in t.Result.Data.Items)
        {
            Console.WriteLine(question.Title);
        }
    });

Asynchronous (C# 5)

var response = await client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

foreach (var user in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Filters

StacMan supports the Stack Exhchange API's concept of filters, which allow applications to specify which fields are included/excluded in the API response.

When a field is excluded, the property returned by StacMan corresponding to the excluded field assumes the default value of the type. For example, when the "default" filter is used, the AnswerCount property of the User object returned by StacMan will be 0, since user.answer_count is not included by the "default" filter.

share|improve this question
1  
Any support for WinRT? –  KronoS Apr 25 '13 at 22:47
add comment

2 Answers

I'm using C# for the first time.

When I compile the StacMan source under the v3.5 framework I get this error:

Error   2   Default parameter specifiers are not permitted   StacManClient.SuggestedEditMethods.cs   

From what I have read, it seems that this error occurs when not using the .NET framework v4 for compiling.

Any suggestions?

Thanks.

share|improve this answer
    
Sorry, you need to use at least C# 4 (the version in which optional parameters were added). –  Emmett Aug 22 '12 at 18:38
add comment

I don't know why but I am not able to install that package. I'll get this error:

PM> Install-Package StacMan
"StacMan 1.0.1.0" wurde erfolgreich installiert.
"StacMan 1.0.1.0" wurde erfolgreich deinstalliert.
Installationsfehler. Rollback wird ausgeführt...
Install-Package : Das Paket "StacMan 1.0.1.0" konnte nicht installiert werden. Sie versuchen, dieses Paket in ein Projekt zu installi
eren, das sich auf ".NETFramework,Version=v4.0,Profile=Client" bezieht, das Paket enthält jedoch keine Assemblyverweise, die mit dies
em Framework kompatibel sind. Wenden Sie sich an den Paketersteller, um weitere Informationen zu erhalten.
Bei Zeile:1 Zeichen:16
+ Install-Package <<<<  StacMan
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

And here is the output for the full profile:

Paket-Manager-Konsolenhost, Version 2.2.40116.9051

Geben Sie "get-help NuGet" ein, um alle verfügbaren NuGet-Befehle anzuzeigen.

PM> Install-Package StacMan
"StacMan 1.0.1.0" wurde erfolgreich installiert.
"StacMan 1.0.1.0" wurde erfolgreich deinstalliert.
Installationsfehler. Rollback wird ausgeführt...
Install-Package : Das Paket "StacMan 1.0.1.0" konnte nicht installiert werden. Sie versuchen, dieses Paket in ein Projekt zu installi
eren, das sich auf ".NETFramework,Version=v4.0" bezieht, das Paket enthält jedoch keine Assemblyverweise oder Inhaltsdateien, die mit
 diesem Framework kompatibel sind. Wenden Sie sich an den Paketersteller, um weitere Informationen zu erhalten.
Bei Zeile:1 Zeichen:16
+ Install-Package <<<<  StacMan
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
share|improve this answer
    
Is the project you are trying to install the package into targeting .Net 4.0 Client Profile or the full .Net 4.0 Framework? Based off this error, StackMan requires the project you're installing it on to target .Net 4.0 Framework, not the Client profile. –  JKor Apr 26 '13 at 18:27
    
I tried both profiles none of them worked. That is very confusing. By the way I never used nuget before. –  rekire Apr 26 '13 at 19:27
1  
I just downloaded the package and took a look at it. The package requires .Net 4.5. The last nuget package that supports .Net 4.0 is version 0.4. I'm not sure how stable it is, but you could install it if you want to. To install it, run this command in the Package Manager: Install-Package StacMan -Version 0.4.0.0 –  JKor Apr 26 '13 at 19:58
    
Oh sh... Well now it works for me too. I changed it to .net 4.5. There should be a note about that. –  rekire Apr 26 '13 at 20:01
    
I agree. Hopefully its stable now. –  JKor Apr 26 '13 at 20:32
1  
I added a note about supported frameworks to the OP. –  JKor Apr 28 '13 at 0:43
add comment

You must log in to answer this question.

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