Skip to main content

getLatestQueryHash

getLatestQueryHash(query): Promise<null | number>

Gets the latest version of a query from the Safelist and returns its hash.

Parameters

query: string

Returns

Promise<null | number>

Example

const hash = await getLatestQueryHash('getFullUserProfile')
const variables = { username: 'sal' }
const url = `https://www.khanacademy.org/api/internal/graphql/getFullUserProfile?hash=${hash}&variables=${encodeURIComponent(JSON.stringify(variables))}`

const response = await fetch(url)
const data = await response.json()

See

hashQuery

Source

src/utils/safelist.ts:85