Integrations
GraphQL API
The GraphQL API is useful for fetching workspace and user metadata including replays, users that belong to a team, and comments added to a replay.
try {
const resp = await fetch('https://api.replay.io/v1/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({
variables: {},
query: query,
}),
})
const json = await resp.json()
if (json.errors) {
throw new Error(json.errors[0].message)
} else if (!json.data) {
throw new Error('No data was returned')
}
return json
} catch (e) {
console.log(e && e.message)
return null
}