put

github API - using curl PUT to add a repo to a team

馋奶兔 提交于 2019-12-03 02:26:11
I am trying to add a repo to a team on github, thus: curl -i -u username:password -X PUT -d "" https://api.github.com/teams/:team/repos/:user/:repo (specifics left out) Pretty much as indicated in the not so verbose documentation. This gives a 500 Internal server error . If I leave out the -d"" it gives a 411 "Content-Length required" , if I specify (using -H ) "Content-Length: 0" : again the 500 error... Any clues? [edit] Answer: the API was giving spurious responses and the docs are not very good there: " :team " is a numerical id assigned by the system (not the name you gave it .. arg!) -

Consequences of POST not being idempotent (RESTful API)

旧时模样 提交于 2019-12-03 01:58:13
问题 I am wondering if my current approach makes sense or if there is a better way to do it. I have multiple situations where i want to create new objects and let the server assign an ID to those objects. Sending a POST request appears to be the most appropriate way to do that. However since POST is not idempotent the request may get lost and sending it again may create a second object. Also requests being lost might be quite common since the API is often accessed through mobile networks. As a

hadoop fs -put command

微笑、不失礼 提交于 2019-12-03 01:19:49
I have constructed a single-node Hadoop environment on CentOS using the Cloudera CDH repository. When I want to copy a local file to HDFS, I used the command: sudo -u hdfs hadoop fs -put /root/MyHadoop/file1.txt / But,the result depressed me: put: '/root/MyHadoop/file1.txt': No such file or directory I'm sure this file does exist. Please help me,Thanks! Alfonso Nishikawa As user hdfs , do you have access rights to /root/ (in your local hdd)?. Usually you don't. You must copy file1.txt to a place where hdfs user has read rights. Try: cp /root/MyHadoop/file1.txt /tmp chown hdfs:hdfs /tmp/file1

Error: C# The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

六眼飞鱼酱① 提交于 2019-12-03 01:14:28
I'm trying to make a request via SSL. The certificate is already installed on the machine and it works via browser. I am using this request: System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] data = encoding.GetBytes(request.Content.OuterXml.ToString()); string password = "XXXX"; X509Certificate2 cert = new X509Certificate2("c:\\zzzz.p12", password); string key = cert.GetPublicKeyString(); string certData = Encoding.ASCII.GetString(cert.Export(X509ContentType.Cert)); Uri uri = new Uri(request.Url); HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(uri);

In REST is POST or PUT best suited for upsert operation?

ⅰ亾dé卋堺 提交于 2019-12-03 00:54:51
I keep a key-value storage in the server for the client. If the user sends key "k1", then I upsert it to the database. Is this considered POST or PUT ? Also I have another operation that removes all existing keys and adds the new key. Is this POST or PUT because it clears records and adds a new one. If the user send key "k1" then I upsert it to the database. Is this considered POST or PUT. According to the HTTP specification : The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity

Why don't browsers support PUT and DELETE requests and when will they?

隐身守侯 提交于 2019-12-02 21:07:11
I'm seeing many frameworks recently that have decided to "fake" PUT and DELETE requests. Like Ruby on Rails. They seem to be waiting for browsers to catch up. Are they waiting in vain? Is this even slated to be implemented anywhere? Nicholas Shanks Browsers do support PUT and DELETE , but it's HTML that doesn't. For example, a browser will initiate a PUT request via Javascript (AJAX), but not via HTML <form> submission. This is because HTML 4.01 and the final W3C HTML 5.0 spec both say that the only HTTP methods that their form elements should allow are GET and POST. There was much discussion

Ruby: PUT Request with JSON body?

那年仲夏 提交于 2019-12-02 20:41:32
I need to create an HTTP PUT request using ruby. The request has a JSON body I was able to generate the JSON body using: require 'rubygems' require 'json' jsonbody = JSON.generate["message"=>"test","user"=>"user1"] I need to send this PUT request to the url: require 'open-uri' url = URI.parse('http://www.data.com?access_token=123') Can someone please tell me how I can do this in Ruby? Using restclient ( gem install rest-client ) like this: require 'rubygems' require 'rest_client' require 'json' jdata = JSON.generate(["test"]) RestClient.put 'http://localhost:4567/users/123', jdata, {:content

RESTful API design: should unchangable data in an update (PUT) be optional?

时光毁灭记忆、已成空白 提交于 2019-12-02 20:16:31
I'm in the middle of implementing a RESTful API, and I am unsure about the 'community accepted' behavior for the presence of data that can not change. For example, in my API there is a 'file' resource that when created contains a number of fields that can not be modified after creation, such as the file's binary data, and some metadata associated with it. Additionally, the 'file' can have a written description, and tags associated. My question concerns doing an update to one of these 'file' resources. A GET of a specific 'file' will return all the metadata, description & tags associated with

Unable to make PUT/POST/DELETE HTTP Call using CORS in JQuery 1.6.4

谁说我不能喝 提交于 2019-12-02 18:23:22
So, I can successfully make a GET call to my service using CORS. However, something must be going wrong at the preflight level for the POST, PUT, and DELETE operations. However, from what I can tell, the header responses my server is returning in response to the OPTIONS query are correct and match those described in Here is my javascript code, using $.ajax in JQuery 1.6.4. $.ajax({ url: 'http://myhome:8080/TaskApproval/resources/tasks/2', context: this, data: '<?xml version="1.0" encoding="UTF-8"?> <task> <description>Get carrots from the grocery store</description><originator>Chris<

should I use PUT method for update, if I also update a timestamp attribute

寵の児 提交于 2019-12-02 17:32:53
To be more precise: According to rest style, it's generally assummed that POST, GET, PUT, and DELETE http methods should be used for CREATE, READ, UPDATE and DELETE (CRUD) operations. In fact, if we stick to the http methods definition the thing might not be so clear In this article it's explained that: In a nutshell: use PUT if and only if you know both the URL where the resource will live, and the entirety of the contents of the resource. Otherwise, use POST. Mainly because PUT is a much more restrictive verb. It takes a complete resource and stores it at the given URL. If there was a