Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

359
Visualizações
AWS Object Tagging using x-amz-tagging request header

I'm uploading the contents of a file to s3 using the Put Object endpoint and attempting to use the x-amz-tagging request header.

See documentation here: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html.

As in example 6 in the link above:

Example 6: Upload an Object and Specify Tags

In this upload object request, you specify the optional x-amz-taggging header to add tags to the object.

Copy PUT /example-object HTTP/1.1 Host: example-bucket.s3.amazonaws.com Accept: /
Authorization:authorization string Date: Thu, 22 Sep 2016 21:58:13 GMT x-amz-tagging: tag1=value1&tag2=value2

[... bytes of object data]

I generate a base string like so used to generate the authorization string:

String baseString = "PUT\n\ntext/plain\n" 
    + currentDate + "\n" 
    + "x-amz-tagging:tag1=value1&tag2=value2" + "\n" 
    + "/" + LOG_BUCKET_NAME + THE_REST_OF_THE_URL;

Then build my request like so:

request.setRawHeader("Date", currentDate);
request.setRawHeader("Authorization", authorizationString);
request.setRawHeader("x-amz-tagging", "tag1=value&tag2=value2);

I get a forbidden error every time but adding metadata works perfectly:

Base string:

String baseString = "PUT\n\ntext/plain\n" 
    + currentDate + "\n" 
    + "x-amz-meta-reviewedby:my_email@domain.com" + "\n" 
    + "/" + LOG_BUCKET_NAME + THE_REST_OF_THE_URL;

And then:

request.setRawHeader("Date", currentDate);
request.setRawHeader("Authorization", authorizationString);
request.setRawHeader("X-Amz-Meta-ReviewedBy", "my_email@domain.com");

Is there perhaps additional user permissions required for adding tags?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It was in fact a permissions issue. The fix involved enabling user permissions for Object Tagging.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda