Hello,
I'm working on a project, where in I need to get the data from server through
RESTful web services.
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".
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.
Is there any way to find out the http method type being implemented for a web
server API?
Right now I'm using a BOOL flag to determine which Http method to use. The flag
is being set from outside.
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"];
}
I wanted to get rid of this BOOL _usePostMethod variable.
Thanks and Regards
Omkar Ramtekkar | Module Lead - Collaboration BU
[email protected]<mailto:[email protected]> |
Cell: +91-9730162294 | Tel: +91-712-398-6261
Persistent Systems Ltd. | 20 Glorious Years |
www.persistentsys.com<http://www.persistentsys.com/>
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the
property of Persistent Systems Ltd. It is intended only for the use of the
individual or entity to which it is addressed. If you are not the intended
recipient, you are not authorized to read, retain, copy, print, distribute or
use this message. If you have received this communication in error, please
notify the sender and delete all copies of this message. Persistent Systems
Ltd. does not accept any liability for virus infected mails.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]