Skip to content

Instantly share code, notes, and snippets.

@ammar-faifi
Last active November 16, 2023 15:38
Show Gist options
  • Save ammar-faifi/f69d313adffffc219eb2d7e9ebb43298 to your computer and use it in GitHub Desktop.
Save ammar-faifi/f69d313adffffc219eb2d7e9ebb43298 to your computer and use it in GitHub Desktop.
sample of requesting no-authorized data from Petroly API
const endpointUrl = 'https://api.petroly.co/';
const graphqlQuery = `
{
search(term: "202320", department: "ICS", title: "")
}
`;
fetch(endpointUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: graphqlQuery,
}),
})
.then(response => response.json())
.then(data => console.log('GraphQL data:', data))
.catch(error => console.error('GraphQL error:', error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment