title: POST request with AFNetworking 2.0 - AFHTTPSessionManager
body: <p>Hej,</p>
  
  <p>I am struggling with doing a POST request to the parse REST API. I am using AFNetworking 2.0. My code for the AFHTTPSessionManager Subclass looks as follows:</p>
  
  <pre><code>+ (ParseAPISession *)sharedSession {
       static ParseAPISession *sharedSession = nil;
       static dispatch_once_t onceToken;
       dispatch_once(&amp;onceToken, ^{
           sharedSession = [[ParseAPISession alloc] initWithBaseURL:[NSURL URLWithString:kSDFParseAPIBaseURLString]];
      });
     return sharedSession;
  }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>- (id)initWithBaseURL:(NSURL *)url {
      self = [super initWithBaseURL:url];
      if (self) {
         [self.requestSerializer setValue:kSDFParseAPIApplicationId forHTTPHeaderField:@"X-Parse-Application-Id"];
         [self.requestSerializer setValue:kSDFParseAPIKey forHTTPHeaderField:@"X-Parse-REST-API-Key"];
     }
  
     return self;
  }
  </code></pre>
  
  <p>I am doing the request like this:</p>
  
  <pre><code>[[ParseAPISession sharedSession] POST:@"ClassName" parameters: [NSDictionary dictionaryWithObjectsAndKeys:@"name", @"name", nil] 
                                success:^(NSURLSessionDataTask *task, id abc) {
                                    NSLog(@"%@", abc);
                                } failure:^(NSURLSessionDataTask *task, NSError *error) {
                                    NSLog(@"%@", error);
  }];
  </code></pre>
  
  <p>Doing this I always get this kind of error:</p>
  
  <blockquote>
    <p>Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x8c72420 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}</p>
  </blockquote>
  
  <p>Since the GET Request works like a charm I am quite confused why I can’t POST something. Can anybody halp me with this problem?</p>
  
  <p>Best regards!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Happily after testing around a lot this Error message isn't displayed anymore, unfortuatelly another appeared:</p>
  
  <pre><code>&lt;NSHTTPURLResponse: 0x8b96d40&gt;
  { URL: https://api.parse.com/1/users }
  { status code: 400, 
  headers {
      "Access-Control-Allow-Origin" = "*";
      "Access-Control-Request-Method" = "*";
      "Cache-Control" = "no-cache";
      Connection = "keep-alive";
      "Content-Length" = 130;
      "Content-Type" = "application/json; charset=utf-8";
      Date = "Wed, 30 Oct 2013 20:01:58 GMT";
      Server = "nginx/1.4.2";
      "Set-Cookie" = "_parse_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlNjIxZjUxMzY3NWVhZWJmMDYyYWYwMGJiZTQ3MThmMWE%3D--851bd31b07e7dba2c5f83bb13a8d801ecbea42c4; domain=.parse.com; path=/; expires=Fri, 29-Nov-2013 20:01:58 GMT; secure; HttpOnly";
      Status = "400 Bad Request";
      "X-Runtime" = "0.060910";
      "X-UA-Compatible" = "IE=Edge,chrome=1";
  } }
  </code></pre>
  
  <p>Can anyone tell me what the Status: 400 Bad Request is telling me and how I can get rid of it? </p>