2

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 400 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.

2
  • @BrockAdams your're right. I updated my question. Commented Mar 6, 2014 at 12:28
  • Could you please share the code for posting question through API? I am trying to post questions through APIs for hours but allways getting 400 error. Commented Dec 8, 2014 at 9:25

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.