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

200
Visualizações
How to remove the HTTP headers from a REST api call in Javascript

Hi i am trying to isolate the part of the response in the {}. It calls from the gemini public database and i am trying to get only the part in the curly braces to save it as a string in a database.

const gemini = async() =>{
    var burl = 'https://api.sandbox.gemini.com'
    var query = '/v1/pubticker/'+'ethusd'
    var url = burl + query
    var smth = fetch(url)
    delete smth.vary
    return smth

}

export default gemini

Here is the response i get

status: 200 OK
    content-length: 133
    content-type: application/json
    date: Mon, 08 Nov 2021 18:03:09 GMT
    server: nginx
    vary: Origin

{"bid":"4786.52","ask":"4787.78","volume":{"ETH":"8232.886562","USD":"38693689.50955448","timestamp":1636394400000},"last":"4786.83"}

This is what i want to isolate

{"ETH":"8232.886562","USD":"38693689.50955448","timestamp":1636394400000},"last":"4786.83"}

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

0

You don't need to "remove the headers". Just get the JSON response and use the data you need from that response. Your gemini function returns a Promise from a fetch call. You'd use that Promise like any other fetch call. For example:

let response = await gemini();
let result = await response.json();

Then result contains the object specified by the JSON data. From the description in the question it sounds like you specifically want the volume and last properties on that object.

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