Administration (GQL)

Obtain environment audit logs

This query is used to obtain logs of actions that Environment Admin users have made in the Admin Panel. These logs are also available in the Audit Trails tab of the Admin Panel.

The value of where.query is a text-based search string. Leaving this empty (as in the example below) returns all entries. Additionally, this query uses Pagination and order by arguments.

query getAdminAuditLogs ($pagination: PaginationArgs, $orderBy: AdminAuditLogSortablesInput, $where: AdminAuditLogInput) {
  adminAuditLogs(pagination: $pagination, orderBy: $orderBy, where: $where)
 {
    edges {
      node {
        id
        action
        eventName
            auditText
        statusCode
        highlight
        createdAt
      }
      cursor
    }
    nodes {
      id
      action
      eventName
      auditText
      statusCode
      highlight
      createdAt
    }
    pageInfo {
      endCursor
      hasNextPage
    }
    totalCount
  }
}
{
  "pagination": {
      "after": "",
      "first": 10
    },
  "orderBy": { "sortingFields": [{
        "fieldName": "CREATED_AT",
        "order": "DESC"
  }]},
  "where": {
    "query": ""
  }
}

Obtain event logs

This query obtains event logs if Events / Webhooks are configured on your Enterprise Hub. The returned data is similar to what is shown in the Events Log tab.

query getEventLogs {
  eventLogs(
  	pagination: {
      first: 20
    },
    orderBy: {
      sortingFields: [{
        fieldName: CREATED_AT,
        order: ASC
        }]
    },
    where: {
      query: "Update"
    }
  ) {
    edges {
      node {
        id
        url
        eventType
    	    eventText
        eventData
        statusCode
        highlight
        createdAt
      }
      cursor
    }
    nodes {
        id
        url
        eventType
    	    eventText
        eventData
        statusCode
        highlight
        createdAt
    }
    pageInfo {
      endCursor
      hasNextPage
    }
    totalCount
  }
}