Skip to main content
1 of 3
Besi
  • 533
  • 3
  • 10

404 when posting a question to the Stackexchange API

I am adding a question via the API and I manage to create a preview of my question (See JSON extract below).

{
    "has_more" = 0;
    items =     (
                {
            "creation_date" = 1393885003;
            "is_answered" = 0;
            "last_activity_date" = 1393885003;
            owner =             {
                "morecontent":"...."
            };
            score = 0;
            tags =             (
                "objective-c",
                osx,
                cocoa,
                nstextview
            );
            title = "How can I....";
        }
    );
    "quota_max" = 10000;
    "quota_remaining" = 9999;
}

However, as soon as I remove the preview flag, I get a 404 error:

0x6080002225a0> { URL: https://api.stackexchange.com/2.2/questions/add } { status code: 400, headers {
    "Access-Control-Allow-Credentials" = false;
    "Access-Control-Allow-Methods" = "GET, POST";
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = private;
    "Content-Encoding" = gzip;
    "Content-Length" = 193;
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Thu, 06 Mar 2014 11:30:47 GMT";
} }, NSLocalizedDescription=Request failed: bad request (400), 

These are my parameters, that I send to the endpoint:

{
    "access_token" = "SECRETSECRET))";
    body = "...";
    "client_id" = 2690;
    key = "MYKEY((";
    site = stackoverflow;
    tags = "git,script,ci,bash";
    title = "How can I....";
}

My request seems to be fine since I get a preview. So I am wondering what I am missing that I can't create question.

Besi
  • 533
  • 3
  • 10