Users

Admin User List

Retrieve first 25 users assigned to the organization. Includes both Approved and Unapproved users.

import requests

# Define the GraphQL endpoint URL
url = "https://app.threatrix.io/graphql"
apikey = "{THREATRIX_API_OR_SERVICE_KEY}" # Replace with your actual service key

# Example GraphQL query - adjust based on your needs
query = """
{
  users(onlyUnapproved: false, first: 25) {
    edges {
      node {
        orgId
        username
        email
        fname
        lname
        created
        permissions
        avatarUrl
        approved
        userRoles {
          roleId
          description
          permissions
          __typename
        }
        userEntities {
          edges {
            node {
              name
              __typename
            }
            __typename
          }
          __typename
        }
        __typename
      }
      __typename
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
      __typename
    }
    totalCount
    __typename
  }
}

"""

# Define the headers with the Bearer token for authentication
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer "+apikey,  
}

# Define the payload to send with the request
payload = {
    "query": query
}

# Make the request to the GraphQL endpoint
response = requests.post(url, json=payload, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the response data
    print("Response data:", response.json())
else:
    print(f"Request failed with status code {response.status_code}")

Last updated