Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!