Github V4 GraphQL API-审核日志查询

时间:2019-05-27 07:45:01

标签: github graphql audit-logging

我正在尝试与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));

1 个答案:

答案 0 :(得分:0)

如果有人在这里寻找解决方案,那么在查看公共架构后,查询就是获取审计日志对象的方式,这当然没有标题和查询前缀。

auditLog是联合类型,您可以通过添加另一个“ ... on”块来获取多个审核事件。例如,在这里,我得到了所有orginvitemembers事件

i haven't tried