There are many ways of communicating with a GraphQL API. You can use a low-level HTTP client like cURL or a dedicated client for the programming language or framework of your choice. The most convenient tool for testing the API and forming queries is Playground. It is an interactive editor which supports features such us autocompletion, error highlighting, setting HTTP headers, and instant access to API documentation in the sidebar.

Let’s take a look at an example query and mutation that you can use in the AVII GraphQL API.

Example query

Here is an example query that fetches three Computer Vision Models and, for each one, returns the ID, name, description, category name, precision, and recall:

query {
  computerVisionModels(first: 3) {
    edges {
      node {
        id
        name
        description
        category {
          name
        }
        precision 
        recall
      }
    }
  }
}

The server returns the following JSON:

{
  "data": {
    "computerVisionModels": {
      "edges": [
        {
          "node": {
            "id": "UHJvZHVjdDo3Mg==",
            "name": "Package Detection Model",
            "description": "Detecting warehouse packages in frames.",
            "category": {
              "name": "Object detection"
            },
            "precision": 98.8, 
            "recall": 99.9,
          }
        },
        {
          "node": {
            "id": "UHJvZHVjdDo3NA==",
            "name": "Zone Access Management Model",
            "description": "Detecting authorized access to restricted zones in a factory.",
            "category": {
              "name": "Zone Access Management"
            },
            "precision": 98.8, 
            "recall": 99.9,
          }
        },
        {
          "node": {
            "id": "UHJvZHVjdDo3OQ==",
            "name": "Dwell Time Analysis Model",
            "description": "Estimating the time spent by workers in their workstations on a production floor in a factory.",
            "category": {
              "name": "Dwell-time Analysis"
            },
            "precision": 98.8, 
            "recall": 99.9,
          }
        }
      ]
    }
  }
}