I’m trying to retrieve a list of quests from this page using this url:
https://graphigo.prd.galaxy.eco/query
Here is my code
const galxeQuestsURL = 'https://graphigo.prd.galaxy.eco/query';
let queryBody = '{"operationName":"CampaignList","variables":{"input":{"listType":"Trending","credSources":null,"gasTypes":null,"types":null,"rewardTypes":null,"chains":null,"isVerified":null,"statuses":null,"spaceCategories":null,"backers":null,"first":20,"after":"-1","searchString":null,"claimableByUser":null},"address":"0x955cc96a6ae344bc9d576b62c6cfbb68d3479bb2"},"query":"query CampaignList($input: ListCampaignInput!, $address: String!) {n campaigns(input: $input) {n pageInfo {n endCursorn hasNextPagen __typenamen }n list {n ...CampaignSnapn isBookmarked(address: $address)n idn numberIDn namen childrenCampaigns {n idn typen rewardNamen rewardInfo {n discordRole {n guildIdn guildNamen roleIdn roleNamen inviteLinkn __typenamen }n __typenamen }n __typenamen }n whitelistInfo(address: $address) {n usedCountn __typenamen }n watchlistPro {n watchListIdn rewardIconGifn rewardIconn rewardCampaignn __typenamen }n infon useCredn formulan thumbnailn gasTypen createdAtn requirementInfon descriptionn enableWhitelistn chainn startTimen statusn requireEmailn requireUsernamen distributionTypen endTimen rewardNamen capn loyaltyPointsn tokenRewardContract {n idn addressn chainn __typenamen }n tokenReward {n userTokenAmountn tokenAddressn depositedTokenAmountn tokenRewardIdn tokenDecimaln tokenLogon tokenSymboln __typenamen }n space {n idn namen thumbnailn aliasn isVerifiedn __typenamen }n rewardInfo {n discordRole {n guildIdn guildNamen roleIdn roleNamen inviteLinkn __typenamen }n premint {n startTimen endTimen chainn pricen totalSupplyn contractAddressn bannern __typenamen }n __typenamen }n participants {n participantsCountn bountyWinnersCountn __typenamen }n recurringTypen __typenamen }n __typenamen }n}nnfragment CampaignSnap on Campaign {n idn namen inWatchListn inNewYearWatchListn ...CampaignMedian dao {n ...DaoSnapn __typenamen }n __typenamen}nnfragment DaoSnap on DAO {n idn namen logon aliasn isVerifiedn __typenamen}nnfragment CampaignMedia on Campaign {n thumbnailn rewardNamen typen gamification {n idn typen __typenamen }n __typenamen}n"}';
fetch(galxeQuestsURL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: queryBody,
})
.then(response => response.json())
.then((jsonData) => {
// jsonData is parsed json object received from url
//console.log(jsonData);
})
.catch((error) => {
// handle your errors here
console.error(error);
});
In Postman the response works fine but when I run this locally with my own code above I get the error:
graphigo.prd.galaxy.eco/query:1
Failed to load resource: the server responded with a status of 400 ()
How can I set up my request correctly? Thank you!