http-put

GitHub API to Create a File

北战南征 提交于 2021-02-18 05:21:09
问题 So I'm trying to familiarize myself with the GitHub API. I'm using cURL commands to implement some of their basic functionality. I can get the basic authorization & repository creation correctly. Currently, I'm trying to create a file in a repository using their API & am facing the "message":"Not Found" error as the response. Their documentation suggests this: PUT /repos/:owner/:repo/contents/:path I came up with this as the cURL equivalent: curl -H 'Authorization: <token>' -d '{"path": "test

Is it possible to use `--data-urlencode` and `--data-binary` options for the same curl command?

≯℡__Kan透↙ 提交于 2020-07-24 03:19:06
问题 I am using curl and I would like to execute a HTTP PUT request by sending a --data-urlencode string and a --data-binary JSON file content. Is it possible to make that in the same curl command? I tried the following curl www.website.org --request PUT -H Content-Type: application/json --data-urlencode "key=sample_string" --data-binary @sample_file.json but it seems do not work as expected: key=sample_string and sample_file.json content are not send at all. 回答1: A couple of things here; Your

Is it possible to use `--data-urlencode` and `--data-binary` options for the same curl command?

谁说胖子不能爱 提交于 2020-07-24 03:17:53
问题 I am using curl and I would like to execute a HTTP PUT request by sending a --data-urlencode string and a --data-binary JSON file content. Is it possible to make that in the same curl command? I tried the following curl www.website.org --request PUT -H Content-Type: application/json --data-urlencode "key=sample_string" --data-binary @sample_file.json but it seems do not work as expected: key=sample_string and sample_file.json content are not send at all. 回答1: A couple of things here; Your

Is it possible to use `--data-urlencode` and `--data-binary` options for the same curl command?

浪子不回头ぞ 提交于 2020-07-24 03:16:26
问题 I am using curl and I would like to execute a HTTP PUT request by sending a --data-urlencode string and a --data-binary JSON file content. Is it possible to make that in the same curl command? I tried the following curl www.website.org --request PUT -H Content-Type: application/json --data-urlencode "key=sample_string" --data-binary @sample_file.json but it seems do not work as expected: key=sample_string and sample_file.json content are not send at all. 回答1: A couple of things here; Your

Uploading to Google Cloud using a signed URL

时间秒杀一切 提交于 2020-01-14 03:27:49
问题 I'm trying to generate download and upload link from the Google Cloud, to view and upload files, using the following code: public class Test { public static void main(String[] args) throws IOException { Storage storage = StorageOptions.newBuilder().setCredentials( ServiceAccountCredentials.fromStream(new FileInputStream("C:/cred/Key.json"))) .build() .getService(); String filePath = "file/path/"; File file = new File(filePath); byte[] bytes = Utilities.fileToByteArray(file); String mimeType =

Uploading a file using ruby Net:HTTP API to a remote apache server failing with 409 Conflict

扶醉桌前 提交于 2020-01-02 10:46:08
问题 Below is a program to upload a file from local file system to a remote Apache server. The program ends with a 409 conflict error. Is there any advice what am I doing wrong? I turned DAV on in httpd.conf and gave all necessary permissions, but I still had no luck. I can post the httpd.conf should it be needed. This is the code: BOUNDARY = "AaB03xZZZZZZ11322321111XSDW" uri = URI.parse("http://localhost/dropbox/") file = "/tmp/KEYS.txt" http = Net::HTTP.new(uri.host, uri.port) request = Net:

Uploading a file using ruby Net:HTTP API to a remote apache server failing with 409 Conflict

喜你入骨 提交于 2020-01-02 10:45:59
问题 Below is a program to upload a file from local file system to a remote Apache server. The program ends with a 409 conflict error. Is there any advice what am I doing wrong? I turned DAV on in httpd.conf and gave all necessary permissions, but I still had no luck. I can post the httpd.conf should it be needed. This is the code: BOUNDARY = "AaB03xZZZZZZ11322321111XSDW" uri = URI.parse("http://localhost/dropbox/") file = "/tmp/KEYS.txt" http = Net::HTTP.new(uri.host, uri.port) request = Net:

Should I allow sending complete structures when using PUT for updates in a REST API or not?

北战南征 提交于 2020-01-02 08:23:10
问题 I am designing a REST API and I wonder what the recommended way to handle updates to resources would be. More specifically, I would allow updates through a PUT on the resource, but what should I allow in the body of the PUT request? Always the complete structure of the resource? Always the subpart (that changed) of the structure of the resource? A combination of both? For example, take the resource http://example.org/api/v1/dogs/packs/p1 . A GET on this resource would give the following: