Traté de usarlo usando los códigos de ejemplo, pero no sé por qué no funciona... Quiero usar anilist Api usando axios en JavaScript, pero los documentos no son fáciles de entender... ( https://anilist .gitbook.io/anilist-apiv2-docs/overview/graphql/getting-started )
Aquí código de ejemplo:
var query = ` query ($id: Int) { # Define which variables will be used in the query (id) Media (id: $id, type: ANIME) { # Insert our variables into the query arguments (id) (type: ANIME is hard-coded in the query) id title { romaji english native } } } `; var variables = { id: 15125 }; var url = 'https://graphql.anilist.co', options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', }, body: JSON.stringify({ query: query, variables: variables }) }; fetch(url, options).then(handleResponse) .then(handleData) .catch(handleError); function handleResponse(response) { return response.json().then(function (json) { return response.ok ? json : Promise.reject(json); }); } function handleData(data) { console.log(data); } function handleError(error) { alert('Error, check console'); console.error(error); }Quiero obtenerlo para poder obtener datos fácilmente dentro de console.log (datos) ¿alguien puede explicarme o ayudarme a usarlo?