put

POST and PUT request AFNetworking

家住魔仙堡 提交于 2019-12-01 17:31:25
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

Backbone.save POST instead of PUT

。_饼干妹妹 提交于 2019-12-01 17:15:27
just a short question: Having the new instance of a model and issuing a model.save() with URL set to /api/store/category , Backbone issues a POST. According to my knowledge, it should use PUT, like mentioned in this "PUT or POST: The REST of the Story" blog post. Who is right? BB or this article's author? nikoshr According to Backbone documentation , saving a new model will result in a POST request, and saving an existing model (having an id) will emit a PUT request. save model.save([attributes], [options]) ... If the model isNew, the save will be a "create" (HTTP POST), if the model already

POST and PUT request AFNetworking

醉酒当歌 提交于 2019-12-01 16:27:09
问题 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? 回答1: I would create a

Getting “411 Length Required” after a PUT request from HTTP Client

你说的曾经没有我的故事 提交于 2019-12-01 15:43:43
I am working on a Java program that implements an HTTP Client. I test it sending requests to a server. GET, POST and DELETE requests work ok. For example after a POST request I get an output Data extracted: {"status":{"message":"ok"}} and the database reflects the changes made. After a PUT request, however I get the following html markup of a webpage indicating an error. Data extracted: <html> <head><title>411 Length Required</title></head> <body bgcolor="white"> <center><h1>411 Length Required</h1></center> <hr><center>nginx/1.2.6</center> </body> </html> and accordingly no changes in the

Get PUT params with Slim PHP

若如初见. 提交于 2019-12-01 14:51:04
问题 I searched, but I didn't find an answer. I have a RESTful API to manage a basic CRUD. I'm trying to create an update method using PUT, but I can't retrieve the params values. I'm using Postman to make the requests, my request looks like: URL http://localhost/api/update/987654321 Params id = 987654321 name = John Smith age = 35 PHP $app = new Slim(); $app->put('/update/:id', function( $id ) use( $app ){ var_dump([ 'id' => $id, 'name' => $app->request->put('name'), 'age' => $app->request->put(

Getting “411 Length Required” after a PUT request from HTTP Client

三世轮回 提交于 2019-12-01 14:35:44
问题 I am working on a Java program that implements an HTTP Client. I test it sending requests to a server. GET, POST and DELETE requests work ok. For example after a POST request I get an output Data extracted: {"status":{"message":"ok"}} and the database reflects the changes made. After a PUT request, however I get the following html markup of a webpage indicating an error. Data extracted: <html> <head><title>411 Length Required</title></head> <body bgcolor="white"> <center><h1>411 Length

ModelAttribute for Restful PUT method not populated value ( JSON )

橙三吉。 提交于 2019-12-01 12:52:38
I'm building a fully restful web app using Spring MVC. When I have a PUT method, my @ModelAttribute form bean is not populated (all values null). If I use the POST method, everything populates correctly. I do a query with Postman ( https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm ) Image Requete Postman : http://www.hostingpics.net/viewer.php?id=474577probleme.jpg @Entity @Table(name = "positiongps") public class PositionGPS implements BaseEntity<Long> { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType

ModelAttribute for Restful PUT method not populated value ( JSON )

拈花ヽ惹草 提交于 2019-12-01 11:49:26
问题 I'm building a fully restful web app using Spring MVC. When I have a PUT method, my @ModelAttribute form bean is not populated (all values null). If I use the POST method, everything populates correctly. I do a query with Postman (https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm) Image Requete Postman : http://www.hostingpics.net/viewer.php?id=474577probleme.jpg @Entity @Table(name = "positiongps") public class PositionGPS implements BaseEntity

PHP accessing Incoming PUT Data

旧巷老猫 提交于 2019-12-01 11:12:36
Is PUT similar to POST? I'm getting some inbound requests (apache) with this: [REQUEST_METHOD] => PUT I've never worked with this request method before. So I have to ask if I'm supposed to process it differently. The people sending me data are claiming to be sending xml. So my script has this: <?php if(isset($HTTP_RAW_POST_DATA)) { mail("me@myemail.com","some title i want", print_r($HTTP_RAW_POST_DATA, true)); }else{ die("not post data"); } ?> I'm stuck here now. If there's a PUT request, do I replace $HTTP_RAW_POST_DATA with something else? According to the php docs , PUT data can be read

RestTemplate usage

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:19:33
I'm trying to use RestTemplate in order to make a PUT . For some reason I can't reproduce the PUT I created using curl that goes through without any problems. Here is my curl call that succeeds and returns 200: curl https://www.exampe.com \ -X PUT \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <bearer-token>" \ -v \ -d '{"json":"object"}' And here is Java code that tried to replicate this curl call. This code in my case will throw HttpClientErrorException with status = 406: boolean result = false; String url = "https://www.example.com"; String json = "{\"json\":\"object\"}";