title: How to determine the Http Method type being implemented for web service API
body: <p>I'm working on a project, where in I need to get the data from server through RESTful web services.</p>
  
  <p>Server side people have implemented a few web services. I need to use those methods, but I'm not sure which http method to use "Get" or "POST".</p>
  
  <p>If I use "GET" as http method and if the server web service is being implemented in "POST" then I get 404 or similar http error code.</p>
  
  <p>Is there any way to find out the http method type being implemented for a web server API?</p>
  
  <p>Right now I'm using a BOOL flag to determine which Http method to use. The flag is being set from outside.</p>
  
  <pre><code>NSMutableURLRequest *urlRequest = nil;
  
  if (_usePostMethod)
  {
      urlRequest = [[NSMutableURLRequest alloc] initWithURL:self.serverURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0f];;
      [urlRequest setHTTPMethod:@"POST"];
      [urlRequest setHTTPBody:[restMessage.message dataUsingEncoding:NSUTF8StringEncoding]];
  }
  else
  {
      urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.serverURL, restMessage.message]]
                                                cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0f];
      [urlRequest setHTTPMethod:@"GET"];
  }
  </code></pre>
  
  <p>I wanted to get rid of this <code>BOOL _usePostMethod</code> variable.</p>