JS Fetch Api how to

Hello, How can I get this site "data"? https://www.dre.cx/ Fetch response json did not give me back anything.
async function fetchData() {
try {
const response = await fetch("https://www.dre.cx/api/graphql?query=");
if (!response.ok) {
throw new Error("Could not fetch resource")
}
const data = await response.json();
console.log(data);
}
catch (error) {
console.error(error);
}
}
fetchData();
async function fetchData() {
try {
const response = await fetch("https://www.dre.cx/api/graphql?query=");
if (!response.ok) {
throw new Error("Could not fetch resource")
}
const data = await response.json();
console.log(data);
}
catch (error) {
console.error(error);
}
}
fetchData();
4 Replies
glutonium
glutonium5mo ago
fetch("https://www.dre.cx/api/graphql", {
"headers": {
"accept": "application/graphql-response+json, application/json, multipart/mixed",
"accept-language": "en-GB,en;q=0.9,bn-BD;q=0.8,bn;q=0.7,en-US;q=0.6",
"content-type": "application/json",
"priority": "u=1, i",
"sec-ch-ua": "\"Google Chrome\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",
"sec-ch-ua-mobile": "?1",
"sec-ch-ua-platform": "\"Android\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin"
},
"referrer": "https://www.dre.cx/api/graphql?query=query+Example+%7B%0A++getCharacterByName%28referenceName%3A+%22Son+Goku%22%29+%7B%0A++++mangaName%0A++++race%0A++++team%0A++++mentors%0A++++students%0A++++dateOfBirth%0A++++dateOfDeath%0A++++address%0A++++aliasName%0A++%7D%0A++getCharacters+%7B%0A++++address%0A++%7D%0A%7D",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{\"query\":\"query Example {\\n getCharacterByName(referenceName: \\\"Son Goku\\\") {\\n mangaName\\n race\\n team\\n mentors\\n students\\n dateOfBirth\\n dateOfDeath\\n address\\n aliasName\\n }\\n getCharacters {\\n address\\n }\\n}\",\"operationName\":\"Example\",\"extensions\":{}}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
});
fetch("https://www.dre.cx/api/graphql", {
"headers": {
"accept": "application/graphql-response+json, application/json, multipart/mixed",
"accept-language": "en-GB,en;q=0.9,bn-BD;q=0.8,bn;q=0.7,en-US;q=0.6",
"content-type": "application/json",
"priority": "u=1, i",
"sec-ch-ua": "\"Google Chrome\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",
"sec-ch-ua-mobile": "?1",
"sec-ch-ua-platform": "\"Android\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin"
},
"referrer": "https://www.dre.cx/api/graphql?query=query+Example+%7B%0A++getCharacterByName%28referenceName%3A+%22Son+Goku%22%29+%7B%0A++++mangaName%0A++++race%0A++++team%0A++++mentors%0A++++students%0A++++dateOfBirth%0A++++dateOfDeath%0A++++address%0A++++aliasName%0A++%7D%0A++getCharacters+%7B%0A++++address%0A++%7D%0A%7D",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{\"query\":\"query Example {\\n getCharacterByName(referenceName: \\\"Son Goku\\\") {\\n mangaName\\n race\\n team\\n mentors\\n students\\n dateOfBirth\\n dateOfDeath\\n address\\n aliasName\\n }\\n getCharacters {\\n address\\n }\\n}\",\"operationName\":\"Example\",\"extensions\":{}}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
});
glutonium
glutonium5mo ago
lanszelot
lanszelotOP5mo ago
First of all, Thank you so much for your help. I got it, Thank you so much
glutonium
glutonium5mo ago
welcm
Want results from more Discord servers?
Add your server