0

Ping the API

by
Published Dec 20, 2024

Use this endpoint to check you are correctly authenticating your requests with your API key.

Script beamer Verified

The script

Submitted by hugo697 Bun
Verified 554 days ago
1
//native
2
type Beamer = {
3
	apiKey: string
4
}
5

6
export async function main(resource: Beamer) {
7
	const url = new URL(`https://api.getbeamer.com/v0/ping`)
8

9
	const response = await fetch(url, {
10
		method: 'POST',
11
		headers: {
12
			'Beamer-Api-Key': resource.apiKey
13
		}
14
	})
15

16
	if (!response.ok) {
17
		const text = await response.text()
18
		throw new Error(`${response.status} ${text}`)
19
	}
20

21
	const data = await response.json()
22

23
	return data
24
}
25