Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
From cURL to JavaScript fetch()

I have a cURL example of an request to a rest API, but I can't seem to replicate it correctly in JavaScript with fetch. Would any of you please help me out? here is the cURL example:

curl https://api.sparebank1.no/open/personal/banking/accounts/all --header "Authorization:Bearer 9VKwFeoS8QfeQEeFxD5MiOf6YlFQR0nOpLF1ZUrHRrWqp3rY7G13hy"

Thx

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here it is:

fetch('https://api.sparebank1.no/open/personal/banking/accounts/all', {
  headers: {
    Authorization: 'Bearer 9VKwFeoS8QfeQEeFxD5MiOf6YlFQR0nOpLF1ZUrHRrWqp3rY7G13hy'
  }
});

The fetch function takes a first parameter, the URL. The second parameter is an object containing keys that describe your request, such as method or headers.

In our case, it's specifying a headers object. This contains key-value pairs of named headers and their corresponding values.

I recommend viewing MDN (if you haven't), it's a useful resource.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda