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

308
Visualizações
GET Fetch working but POST Fetch not working - Google APIs in Chrome Extension

I am still not understanding how fetch requests are structured. In my Chrome Extension, I have used an API key from my console to GET some values from a spreadsheet:

let fetch_url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}?key=${API_KEY}`;

It worked, but when I want to append some values, it doesn't:

let fetch_url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/Teachers!A7:D8:append?key=${API_KEY}`;
    
let fetch_options = {
                       "method": "POST",
                       "body": JSON.stringify({
                                 "values": [
                                              ["Door", "$15", "2", "3/15/2016"],
                                              ["Engine", "$100", "1", "3/20/2016"],
                                           ]
                                  })
                    };

I get a 401 response, what am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you check the doucmentation sheet values

You will notice that it states

enter image description here

This is because this method is preformed on a private user data. This means that you need an authorization header with a valid oauth2 access token with one of those scopes in order to access that method.

Authorize the request and then you will be able to access the data. There is a javascript guild which might help you understand how to preform the authorization of your application.

about 4 years ago · Juan Pablo Isaza 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