put

How to send a POST request with BODY in swift

孤街浪徒 提交于 2019-11-26 11:43:21
I'm trying to make a post request with a body in swift using Alamofire. my json body looks like : { "IdQuiz" : 102, "IdUser" : "iosclient", "User" : "iosclient", "List":[ { "IdQuestion" : 5, "IdProposition": 2, "Time" : 32 }, { "IdQuestion" : 4, "IdProposition": 3, "Time" : 9 } ] } I'm trying to make let list with NSDictionnary which look like : [[Time: 30, IdQuestion: 6510, idProposition: 10], [Time: 30, IdQuestion: 8284, idProposition: 10]] and my request using Alamofire looks like : Alamofire.request(.POST, "http://myserver.com", parameters: ["IdQuiz":"102","IdUser":"iOSclient","User":

How to send PUT, DELETE HTTP request in HttpURLConnection?

China☆狼群 提交于 2019-11-26 11:33:14
I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS requests but I still haven't found any sample code which successfully performs PUT and DELETE requests. Matthew Murdoch To perform an HTTP PUT: URL url = new URL("http://www.example.com/resource"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestMethod("PUT"); OutputStreamWriter out = new OutputStreamWriter( httpCon

How do I allow a PUT file request on Nginx server?

末鹿安然 提交于 2019-11-26 09:48:35
问题 I am using an application which needs to PUT a file on a HTTP server. I am using Nginx as the server but getting a 405 Not Allowed error back. Here is an example of a test with cURL: curl -X PUT \\ -H \'Content-Type: application/x-mpegurl\' \\ -d /Volumes/Extra/playlist.m3u8 http://xyz.com And what I get back from Nginx: <html> <head><title>405 Not Allowed</title></head> <body bgcolor=\"white\"> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.1.19</center> </body> </html> What

What is the main difference between PATCH and PUT request?

流过昼夜 提交于 2019-11-26 07:55:34
问题 I am using a PUT request in my Rails application. Now, a new HTTP verb, PATCH has been implemented by browsers. So, I want to know what the main difference between PATCH and PUT requests are, and when we should use one or the other. 回答1: HTTP verbs are probably one of the most cryptic things about the HTTP protocol. They exist, and there are many of them, but why do they exist? Rails seems to want to support many verbs and add some verbs that aren't supported by web browsers natively. Here's

Is there any way to do HTTP PUT in python

白昼怎懂夜的黑 提交于 2019-11-26 05:57:08
问题 I need to upload some data to a server using HTTP PUT in python. From my brief reading of the urllib2 docs, it only does HTTP POST . Is there any way to do an HTTP PUT in python? 回答1: I've used a variety of python HTTP libs in the past, and I've settled on 'Requests' as my favourite. Existing libs had pretty useable interfaces, but code can end up being a few lines too long for simple operations. A basic PUT in requests looks like: payload = {'username': 'bob', 'email': 'bob@bob.com'} >>> r =

Should a RESTful &#39;PUT&#39; operation return something

筅森魡賤 提交于 2019-11-26 04:56:53
问题 I was wondering what people\'s opinions are of a RESTful PUT operation that returns nothing (null) in the response body. 回答1: The HTTP specification (RFC 2616) has a number of recommendations that are applicable. Here is my interpretation: HTTP status code 200 OK for a successful PUT of an update to an existing resource. No response body needed. (Per Section 9.6, 204 No Content is even more appropriate.) HTTP status code 201 Created for a successful PUT of a new resource, with the most

Curl and PHP - how can I pass a json through curl by PUT,POST,GET

╄→гoц情女王★ 提交于 2019-11-26 03:29:52
问题 I have been working on building an Rest API for the hell of it and I have been testing it out as I go along by using curl from the command line which is very easy for CRUD I can successfully make these call from the command line curl -u username:pass -X GET http://api.mysite.com/pet/1 curl -d \'{\"dog\":\"tall\"}\' -u username:pass -X GET http://api.mysite.com/pet curl -d \'{\"dog\":\"short\"}\' -u username:pass -X POST http://api.mysite.com/pet curl -d \'{\"dog\":\"tall\"}\' -u username:pass

How to send a POST request with BODY in swift

旧街凉风 提交于 2019-11-26 02:33:18
问题 I\'m trying to make a post request with a body in swift using Alamofire. my json body looks like : { \"IdQuiz\" : 102, \"IdUser\" : \"iosclient\", \"User\" : \"iosclient\", \"List\":[ { \"IdQuestion\" : 5, \"IdProposition\": 2, \"Time\" : 32 }, { \"IdQuestion\" : 4, \"IdProposition\": 3, \"Time\" : 9 } ] } I\'m trying to make let list with NSDictionnary which look like : [[Time: 30, IdQuestion: 6510, idProposition: 10], [Time: 30, IdQuestion: 8284, idProposition: 10]] and my request using

How to send PUT, DELETE HTTP request in HttpURLConnection?

时光怂恿深爱的人放手 提交于 2019-11-26 02:27:34
问题 I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS requests but I still haven\'t found any sample code which successfully performs PUT and DELETE requests. 回答1: To perform an HTTP PUT: URL url = new URL("http://www.example.com/resource"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true);

What&#39;s the difference between a POST and a PUT HTTP REQUEST?

泄露秘密 提交于 2019-11-26 02:26:24
They both seem to be sending data to the server inside the body, so what makes them different? Brian R. Bondy HTTP PUT: PUT puts a file or resource at a specific URI, and exactly at that URI. If there's already a file or resource at that URI, PUT replaces that file or resource. If there is no file or resource there, PUT creates one. PUT is idempotent , but paradoxically PUT responses are not cacheable. HTTP 1.1 RFC location for PUT HTTP POST: POST sends data to a specific URI and expects the resource at that URI to handle the request. The web server at this point can determine what to do with