Query for machine instances using the indicated index.

GET /machines/{machineSlug}/indexes/{index}/query

Using an index specified during machine creation and defined during machine version creation, query for instances of the provided machine that have an indexed value that matches the provided filters.

Path parameters

  • machineSlug string Required

    The slug/name for the machine definition.

    Minimum length is 1. Format should match the following pattern: ^[a-zA-Z0-9_-]{1,128}$.

  • index string Required

    The name for the machine index.

    Format should match the following pattern: ^[a-zA-Z0-9_-]{1,128}$.

Query parameters

  • op string

    The operation for the filter.

    Values are eq, ne, gt, gte, lt, or lte.

  • value string

    The value for the filter.

  • dir string

    The sort direction for the index.

    Values are asc or desc.

  • limit number

    The maximum number of items to return.

  • cursor string

    The cursor returned from a previous call to query.

Responses

  • The query was executed successfully.

    Hide response attributes Show response attributes object
    • instances array[object] Required
      Hide instances attributes Show instances attributes
      • indexValue string Required

        The value of the index property for this instance.

      • slug string Required

        An identifier for the machine instance. Must be unique within the instances for the associated machine definition.

        Minimum length is 1. Format should match the following pattern: ^[a-zA-Z0-9_-]{1,128}$.

    • cursor string
  • The request was unauthorized.

    Hide response attributes Show response attributes object
    • error string

      A description of the error.

    • code string

      A code specifying the type of error.

      Values are missing-scope, rejected-by-machine-authorizer, missing-user, or missing-org.

GET /machines/{machineSlug}/indexes/{index}/query
curl \
 -X GET https://api.statebacked.dev/machines/my-machine/indexes/{index}/query \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "instances": [
    {
      "indexValue": "string",
      "slug": "user-1234"
    }
  ],
  "cursor": "string"
}
Response examples (200)
{
  "instances": [
    {
      "indexValue": "string",
      "slug": "user-1234"
    }
  ],
  "cursor": "string"
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}