vmbrasseur / IAS3API

Documentation for the Internet Archive S3 API
Other
72 stars 13 forks source link

examples/curl-update_metadata.md #19

Closed sash-kan closed 8 years ago

sash-kan commented 9 years ago

i have read examples/curl-update_metadata.md and tried:

$ curl --location \ --header 'x-archive-ignore-preexisting-bucket:1' \ --header 'x-archive-meta01-collection:opensource' \ --header 'x-archive-meta-mediatype:software' \ --header 'authorization: LOW myaccesskey:mysecretkey' \ --upload-file /dev/null \ http://s3.us.archive.org/lxfrudvd180 but received "411 Length Required" error ("A request of the requested method PUT requires a valid Content-length.").

i tried to add a header "Content-Length:0", but the error is the same.

jamshid commented 9 years ago

Don't know but I see with -v that curl is doing the PUT with Transfer-encoding: chunked which archive.org apparently doesn't support. I guess you need to create an empty file touch /tmp/empty and --upload-file /tmp/empty.

sash-kan commented 9 years ago

@jamshid thank you, it works!

@vmbrasseur i think it makes sense to update the documentation (examples/curl-update_metadata.md).

vmbrasseur commented 9 years ago

Thanks, @sash-kan & @jamshid.

@sash-kan I agree the docs should be updated but am a bit pegged right now. Any chance of a pull request?

jjjake commented 8 years ago

@sash-kan The following command allows for you to destroy and re-specify metadata without uploading a file:

curl --location \
  --header 'x-archive-ignore-preexisting-bucket:1' \
  --header 'x-archive-meta01-collection:opensource' \
  --header 'x-archive-meta-mediatype:texts' \
  --header 'x-archive-meta-title:Fancy new title' \
  --header "authorization: LOW $accesskey:$secret" \
  --header 'Content-Length:0' \
  --request PUT \
  http://s3.us.archive.org/sam-s3-test-08

I'll update examples/curl-update_metadata.md and send a PR.