Translate the network request of an API call into a nodejs fetch request

1 Answer 357 Views
Fiddler Everywhere MacOS
Top achievements
Rank 1
Mike asked on 09 Nov 2022, 02:58 PM

Hi - the music service Tidal has an undocumented API, and I am trying to use Fiddler to turn an API call into something I could code with javascript. I tried taking the raw request and the relevant headers (including the auth token), and making a fetch request, but I'm getting a `400 bad request` error. How do I make a successful request based off the data I'm getting from tidal?

For more details:

A raw request originating from using their desktop app looks like this:

Connection: keep-alive
Cache-Control: max-age=0
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102"
authorization: Bearer [MY_TOKEN]
if-none-match: "09e94392f43a10130f3782b0bd97b5c86"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) TIDAL/2.33.2 Chrome/102.0.5005.167 Electron/19.0.14 Safari/537.36
sec-ch-ua-platform: "macOS"
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US

I am trying to make that same call using javascript / node (I could potentially use another language, but this is what I'm most familiar with).

const fetch = require("node-fetch");
const API_ADDRESS = "";
const TEMP_REQUEST = "folderId=root&includeOnly=&offset=0&limit=50&order=DATE&orderDirection=DESC&countryCode=US&locale=en_US&deviceType=DESKTOP HTTP/1.1";

const fetchMusic = async () => {
  const response = await fetch(`${API_ADDRESS}${TEMP_REQUEST}}`, {
    method: "POST",
    headers: {
      Host: "",
      Authorization: `${MY_TOKEN}`,
  const data = await response.json();


when I do this, I get an error like:


  timestamp: '2022-11-08T16:08:34.517+0000',
  path: '/v2/my-collection/playlists/folders',
  status: 500,
  error: 'Internal Server Error',
  message: '400 Bad Request from POST',
  requestId: 'eb83f8d5-486790'

1 Answer, 1 is accepted

Sort by
Rosen Vladimirov
Telerik team
answered on 09 Nov 2022, 05:06 PM

Hi Mike,

When you capture the session with Fiddler Everywhere, you can just right-click it and use the Copy -> Copy as Fetch option from the context menu. This will generate a code, which can work with the latest versions of Node.js and the integrated fetch.
Before that, you can try executing the request through Fiddler Everywhere's composer. Just right-click on the captured session and select "Edit in Composer". Then you can use the Execute button from there and modify the headers and the body until you have a success. Once you have successfully called the API, you can get back to the list of sessions, right-click the one you want to have in a code and click Copy -> Copy as Fetch. 

Rosen Vladimirov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Fiddler Everywhere MacOS
Asked by
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Share this question