title: Youtube API iOS : Request failed: bad request (400)
body: <p>I am developing an iOS app which require to get youtube channel and subscribe it.
  I can get list of channels without OAuth2 but for subscribe it I need to get access token by OAuth2 standard. </p>
  
  <p>I can get access token by some handwork. But when I send this token into header with request into body for subscribe then it is giving me 'Bad Request (400)' Error.</p>
  
  <h2>Code for send request</h2>
  
  <pre><code>NSString *URLString = [NSString stringWithFormat:@"https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&amp;key=%@", @"[mykey]"];
  
      AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
  
      AFHTTPRequestSerializer *requestSerializer = [AFHTTPRequestSerializer serializer];
  
      [requestSerializer setValue:[NSString stringWithFormat:@"Bearer %@",[self accessToken]] forHTTPHeaderField:@"Authorization"];
      [requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
  
      manager.requestSerializer = requestSerializer;
  
      NSDictionary *parameters = @{@"snippet":@{
                                           @"resourceId":@{
                                                   @"channelId":[[[videoCountDetailArray objectAtIndex:0] valueForKey:@"snippet"] valueForKey:@"channelId"],
                                                   @"kind":@"youtube#channel"
                                                   }
                                           }
                                   };
  
      [manager POST:URLString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
          NSLog(@"response ; %@",responseObject);
  
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"failed");        
      }];
      }
  </code></pre>
  
  <h2>Getting Following error</h2>
  
  <pre><code>Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: bad request (400)" UserInfo={com.alamofire.serialization.response.error.response=&lt;NSHTTPURLResponse: 0x7fcfbccae3a0&gt; { URL: https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&amp;key=myKey } { status code: 400, headers {
      "Cache-Control" = "private, max-age=0";
      "Content-Encoding" = gzip;
      "Content-Length" = 118;
      "Content-Type" = "application/json; charset=UTF-8";
      Date = "Wed, 25 May 2016 09:28:57 GMT";
      Expires = "Wed, 25 May 2016 09:28:57 GMT";
      Server = GSE;
      Vary = "Origin, X-Origin";
      "alt-svc" = "quic=\":443\"; ma=2592000; v=\"34,33,32,31,30,29,28,27,26,25\"";
      "alternate-protocol" = "443:quic";
      "x-content-type-options" = nosniff;
      "x-frame-options" = SAMEORIGIN;
      "x-xss-protection" = "1; mode=block";
  } },
  </code></pre>
  
  <p>Any help will be appriciated.</p>