title: NSUrlConnection and cURl
body: <p>I'm new to NSUrlConnection. I have this cUrl:</p>
  
  <pre><code>curl -X POST 
   -H "Authorization: Basic someReallyLongCode"  
   -H 'Content-Type: application/json' 
   -d '{ "Payment": { "TotalAmount": 100 }, "RedirectURL": "https://www.mydomain.com.au/results?order=0001" }' 
   https://api.sandbox.ewaypayments.com/AccessCodes
  </code></pre>
  
  <p>Is this code correct in Objective C?</p>
  
  <pre><code>- (void)viewDidLoad{
  [super viewDidLoad];
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.sandbox.ewaypayments.com/AccessCodes"]];
  
  [request setHTTPMethod:@"POST"];
  [request setValue:@"Basic someReallyLongCode" forHTTPHeaderField:@"Authorization"];
  [request setValue:@"application/json" forHTTPHeaderField:@"Content-type"];
  
  NSString *stringData = @"{ \"Payment\": { \"TotalAmount\": 100 }, \"RedirectURL\": \"https://www.mydomain.com.au/results?order=0001\" }";
  [request setHTTPBody:[stringData dataUsingEncoding:NSUTF8StringEncoding]];
  
  a = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  }
  </code></pre>