Public key for browser push
const url = 'https://foxleague.ai/api/push/vapid-key';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://foxleague.ai/api/push/vapid-keyAnswers the public key a browser needs to subscribe to push notifications. public_key is null when push notifications are not available; the app then hides the option.
Who: anyone.
Refusals: none.
Responses
Section titled “ Responses ”Success or a refusal: read success (the refusals are in the description).
object
A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.
The answer. Present when success is true.
object
The public key (base64url) to pass to the browser’s push subscription; null when push notifications are not available.
Why the request was refused, in plain words. Present when success is false.
true when the request did what it asked. false is a refusal: read error.
Example
{ "data": { "public_key": "BOq8xS3m0kq2p3Vf7mBf1yJxYzQk9n4c2Hq6WlYtD5r8UoE1aZcXvB7nM0sK3pL6dF9gH2jR5tW8yA1bC4eG7iI" }, "success": true}