title: How do I use ASI Http in iOS to POST data to a web service?
body: <p>I am using the instructions provided in the ASI page <a href="http://allseeing-i.com/ASIHTTPRequest/How-to-use" rel="noreferrer">here</a>. I am trying to send some data to a web service and not seeing any results.</p>
  
  <p>This is my <code>sendRequest</code> method which gets called in <code>viewDidLoad</code></p>
  
  <pre><code>-(void)sendRequest {
      NSURL *url = [NSURL URLWithString:@"http://153.60.6.75:8080/BarcodePayment/transactions"];
      ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
      [request addRequestHeader:@"Accept" value:@"application/json"];
      [request addRequestHeader:@"Content-Type" value:@"application/json"];
      NSString *dataContent = @"{\"id\":7,\"amount\":7.0,\"paid\":true}";
      NSLog(@"dataContent: %@", dataContent);
      [request appendPostData:[dataContent dataUsingEncoding:NSUTF8StringEncoding]];
      [request setRequestMethod:@"POST"];
  }
  </code></pre>
  
  <p>I check the <code>dataContent</code> string and the output is</p>
  
  <pre><code>{"id":7,"amount":7.0,"paid":true}
  </code></pre>
  
  <p>If I use curl from Terminal, I checked and this command works. </p>
  
  <pre><code>curl -X POST -H 'Accept:application/json' -H 'Content-Type: application/json' http://153.60.6.75:8080/BarcodePayment/transactions/ --data '{"id":7,"amount":7.0,"paid":true}'
  </code></pre>
  
  <p>My understanding is that in using curl, I set it to json, specify the address, specify the data which is equivalent to <code>dataContent</code> in my code. Nothing happens. What's wrong?</p>
  
  <p>Thanks for the help!</p>