Last active
November 16, 2023 15:38
-
-
Save ammar-faifi/f69d313adffffc219eb2d7e9ebb43298 to your computer and use it in GitHub Desktop.
sample of requesting no-authorized data from Petroly API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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