【发布时间】:2019-10-12 18:36:14
【问题描述】:
我正在尝试与 github api v4 交互,我想根据 api 中可用的模式查询审计日志事件。我可以找到关于 github api here 的纪录片,并且可以看到可用的架构 here,但没有关于如何查询不同架构的工作示例。
如果这里有人使用过这个 API,特别是审计日志模式,我需要一个工作示例来开始与审计日志模式交互...
例如,我想查询所有组织添加成员到团队事件,假设在架构 TeamAddMemberAuditEntry 中,或从组织 OrgRemoveMemberAuditEntry 中删除成员
到目前为止,我已经尝试使用 node.js 进行查询:
require('isomorphic-fetch');
fetch('https://api.github.com/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json',
'Authorization': 'bearer <token>',
'Accept': 'application/vnd.github.audit-log- preview+json'},
body: JSON.stringify({ query: '{ TeamAddMemberAuditEntry }' }),
})
.then(res => res.json())
.then(res => console.log(res.data));
【问题讨论】:
标签: github graphql audit-logging