title: How to call a JSON Method in iOS
body: <p>There is a JSON call which when i call via curl like below: <br/></p>
  
  <blockquote>
    <p>curl -H
    "Content-Type:application/json" -H
    "Accept:application/json"  -d
    "{\"checkin\":{\"message\":\"this is a
    test\"}}"
    <a href="http://gentle-rain-302.heroku.com/checkins.json" rel="nofollow">http://gentle-rain-302.heroku.com/checkins.json</a></p>
  </blockquote>
  
  <p>I get this result: <br/></p>
  
  <blockquote>
    <p>{"checkin":{"created_at":"2011-01-29T13:52:49Z","id":3,"message":"this
    is a
    test","updated_at":"2011-01-29T13:52:49Z"}}</p>
  </blockquote>
  
  <p>But when i call in my iPhone App like below: <br/></p>
  
  <pre><code>- (void)doCheckIn:(NSString *)Str
  {
      NSString *path = [[NSBundle mainBundle] bundlePath];
      NSString *finalPath = [path stringByAppendingPathComponent:@"inStore-settings.plist"];
      NSDictionary *plistDictionary = [[NSDictionary dictionaryWithContentsOfFile:finalPath] retain];
  
      NSString *appURL = [plistDictionary objectForKey:@"apiurl"];
      appURL = [appURL stringByAppendingString:@"checkins.json"];
      ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:appURL]];
      [request setPostValue:@"{\"checkin\":{\"message\":\"test\"}}" forKey:@"message"];
      [request startSynchronous];
      NSError *error = [request error];
      if (!error) {
          NSString *response = [request responseString];
          NSLog(response);
      }
  }
  </code></pre>
  
  <p>I get a result saying : </p>
  
  <blockquote>
    <p>"The change you wanted was rejected
    (422)"</p>
  </blockquote>
  
  <p>Any help is highly appreciated.</p>