-1

Using cURL to call the JSON API with a PUT Object request is not working +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ curl -i -X PUT --data-binary @CHUNK_LOCATION
-H "Content-Length: CHUNK_SIZE"
-H "Content-Range: bytes CHUNK_FIRST_BYTE-CHUNK_LAST_BYTE/TOTAL_OBJECT_SIZE"
"SESSION_URI" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ i have used the curl commands as described in the google documentation to upload a file using the resumable option in a multi chunk way. but for every put option, the file is being read and uploaded from the starting byte, eventhough i explicitly mentioned the Content-Range header.

For example for the first put method - i can see 0-262143 bytes were uploaded...

curl -v -i -X PUT -r 0-262143 -H "Content-Length: 262144" -H "Content-Range: bytes 0-262143/1953920" --data-binary @"C:\Users\adm-SKoya2\Desktop\gcs-poc\file100_2.txt" "https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=resumable&name=file100_2.txt&upload_id=ADPycdvB5F-d0QY"

For the second put method - i can see the file again was getting uploaded/updated with 0- 524287 bytes.. As a result i am seeing the duplicate or repeated or same content (starting from the first byte) again and again in the file.

curl -v -i -X PUT -r 262144-524287 -H "Content-Length: 262144" -H "Content-Range: bytes 262144-524287/1953920" --data-binary @"C:\Users\adm-SKoya2\Desktop\gcs-poc\file100_2.txt" "https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=resumable&name=file100_2.txt&upload_id=ADPycdvB5F-d0QY"

What was wrong in my commands?

  • The issue is fixed after i use the java method to split the file based on the chunk size.. and for each iteration i provided the chunk location to the input argument --data-binary @CHUNK_LOCATION – Srikanth Koya Aug 31 '23 at 14:56

1 Answers1

0

The issue is fixed after i use the java method to split the file based on the chunk size.. and for each iteration i provided the chunk location (split file names) to the input argument --data-binary @CHUNK_LOCATION