Skip to main content

Fetch

Scripts can use the Fetch API to make network requests to external services.

Reference Document

Fetch API

Example

// GET Request
const response = await fetch('https://api.github.com/orgs/vikadata');
const orgInfo = await response.json();

// POST Request
const data = {
id: 'xxx',
content: 'Test Content'
};

const response = await fetch('https://example.com/postMsg', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});

const result = await response.json();