Skip to content

用户

查看用户列表。

const TOKEN = '123456';

const url = 'https://api.cloudflare.com/client/v4/accounts';
const options = { method: 'GET', headers: { 'Authorization': 'Bearer ' + TOKEN } };

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}

查看用户信息。

const TOKEN = '123456';
const ID = '1234';

const url = `https://api.cloudflare.com/client/v4/accounts/${ID}`;
const options = { method: 'GET', headers: { 'Authorization': 'Bearer ' + TOKEN } };

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data.result);
} catch (error) {
  console.error(error);
}

联系 math@baima.site