title: AFnetworking keep returning response Code=-1011 "Request failed: client error (422)
body: <p>I'm try to use AFNetworking to create a POST request. However I always return an error says: </p>
  
  <pre><code>    Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: client error (422)" UserInfo=0x7ff1fa76a5c0 {com.alamofire.serialization.response.error.response=&lt;NSHTTPURLResponse: 0x7ff1fa76ce40&gt; { URL: https://isisfriends.zendesk.com/requests/mobile_api/create.json } { status code: 422, headers {
      "Cache-Control" = "no-cache";
      Connection = "keep-alive";
      "Content-Length" = 33;
      "Content-Type" = "application/json; charset=UTF-8";
      Date = "Mon, 20 Oct 2014 14:56:54 GMT";
      P3P = "CP=\"NOI DSP COR NID ADMa OPTa OUR NOR\"";
      Server = nginx;
      "Set-Cookie" = "_zendesk_shared_session=eyJpZCI6IjUxYjdmOGFjMzZjMzE1MjRjNDE0OTFiMjRmYmYzNjhhIiwibG9jYWxlX2lkIjoxfQ%3D%3D--229c90ddd7cf33dc5886aba445fd51cccaf69ea7; path=/; secure; HttpOnly, _zendesk_session=BAh7CkkiD3Nlc3Npb25faWQGOgZFVEkiJWVhZTRmZTQ5ZDQ1NmZjOTgzZDBlMzgyMWQ5YjMwMjNlBjsAVEkiDGFjY291bnQGOwBGaQMdNgdJIgpyb3V0ZQY7AEZpAuq9SSIOaXNfbW9iaWxlBjsAVFRJIhN3YXJkZW4ubWVzc2FnZQY7AFR7AA%3D%3D--c8bf5a2774eb5fdaa8ff7ec2da6adef3f76b15c3; path=/; secure; HttpOnly";
      Status = "422 Unprocessable Entity";
      Vary = Accept;
      "X-Frame-Options" = SAMEORIGIN;
      "X-Rack-Cache" = "invalidate, pass";
      "X-Request-Id" = b71fc58dc1cf122d395b77968aff9014;
      "X-Runtime" = "0.088859";
      "X-UA-Compatible" = "IE=Edge,chrome=1";
      "X-XSS-Protection" = "1; mode=block";
      "X-Zendesk-Origin-Server" = "app13.pod2.sac1.zdsys.com";
      "X-Zendesk-Request-Id" = 10c9143fd5ac87ab66d3;
  } }, NSErrorFailingURLKey=https://isisfriends.zendesk.com/requests/mobile_api/create.json, com.alamofire.serialization.response.error.data=&lt;7b226572 726f7222 3a22496e 76616c69 6420656d 61696c20 61646472 65737322 7d&gt;, NSLocalizedDescription=Request failed: client error (422)}
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>NSString * question = [_textFieldQuestion text];
  NSString * detail = [_textFieldDetails text];
  NSString * email = [_textFieldEmail text];
  
  if(question.length &gt; 0 &amp;&amp; detail.length &gt; 0 &amp;&amp; email.length &gt; 0)
  {
      NSString *url = @"https://isisfriends.zendesk.com/requests/mobile_api/create.json";
      NSDictionary *parameters = @{@"subject":question, @"description":detail, @"email":email};
  
  
      AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
  
  
      AFJSONRequestSerializer *reqSerializer = [AFJSONRequestSerializer serializer];
      [reqSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
      [reqSerializer setValue:@"1.0" forHTTPHeaderField:@"X-Zendesk-Mobile-API"];
  
  
      manager.requestSerializer = reqSerializer;
      manager.responseSerializer = [AFJSONResponseSerializer serializer];
  
      NSLog(parameters.descriptionInStringsFileFormat);
  
      [manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
          NSLog(@"===== JSON: ======= %@", responseObject);
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"============== Error: ============\n%@", [error description]);
      }];
  
  
  } else {
  
  }
  </code></pre>
  
  <p>I'm petty sure the parameters I provided (subject, description, email)is corrent, becuase if I put the parameters directly in the url like below, it works fine.</p>
  
  <pre><code>https://isisfriends.zendesk.com/requests/mobile_api/create.json?subject=testing&amp;email=testing@asd.com&amp;description=testing
  </code></pre>