I’m trying to do a call to a server. The GET call is working great and returns the correct json, but when I try to do a PUT or a POST, the server returns an error.
I set the server to receive the next messages:
method POST
curl -X POST -d "number=NUMBER&name=NAME&lat=32.5713&lon=60.3926" http://server.com/users/
method PUT
curl -X PUT -d "number=USER&name=NAME6&lat=-34.5552&lon=32.3333" http://server.com/users/
How can I call to the server with these two methods?
I would create a APIClient class for all requests instead of creating a new client every time i make a request.
See : https://github.com/AFNetworking/AFNetworking/tree/master/Example/Classes
AFTwitterAPIClient.h & AFTwitterAPIClient.m
but based on your question.
I believe the code will look something like this. (Code was not tested)
As for the post request.. just use postPath instead of putPath and it’ll work fine. 🙂
Hope I’ve helped.