CLI Reference

Graphlit entities, such as Contents and Feeds, support CRUD (create-read-update-delete) operations via the CLI.

Specifically, each of the entities below supports the create, get, query, update, delete, and clear verbs. (Clear means 'delete all' entities.)

g {verb} --type {entity-type}

Verb names, such as create are case-sensitive. Entity types such as Content are case-insensitive.

Contents

Feeds

Workflows

Conversations

Specifications

For example, to create content, you can use:

g create --type content

And to clear all conversations, you can use:

g clear --type conversation

For operations on specific entities, you pass the --id argument, such as:

g update --type specification --id "{guid}"

Or:

g disable --type feed --id "{guid}"

The CLI will interactively ask for more input, as needed.

GraphQL JSON output

The CLI supports JSON output of the GraphQL request, variables and response by adding the --json argument to the command line. This can be useful for testing out the API interactively, and then copy/pasting the query/mutation and variables into your code.

g get --type content --id "{guid}" --json

This returns a formatted output of the GraphQL query or mutation, the variables provided, and the JSON output from the GraphQL request.

GraphQL mutation [GetContent]:
query GetContent($id: ID!) {
  content(id: $id) {
    id
    name
    creationDate
    owner {
      id
    }
    state
    originalDate
    finishedDate
    workflowDuration
    uri
    type
    fileType
    mimeType
    fileName
    fileSize
    masterUri
    textUri
    audioUri
    transcriptUri
    links {
      uri
      linkType
    }
    error
    summary
    headlines
    bullets
    posts
    chapters
    questions
    deviceType
    address {
      streetAddress
      city
      region
      country
      postalCode
    }
    location {
      latitude
      longitude
    }
    video {
      width
      height
      duration
      make
      model
      software
    }
    audio {
      title
      bitrate
      channels
      sampleRate
      bitsPerSample
      duration
    }
    image {
      width
      height
      resolutionX
      resolutionY
      bitsPerComponent
      components
      projectionType
      orientation
      description
      make
      model
      software
      lens
      focalLength
      exposureTime
      fNumber
      iso
      heading
      pitch
    }
    document {
      title
      subject
      summary
      author
      publisher
      description
      keywords
      pageCount
    }
    email {
      identifier
      subject
      labels
      sensitivity
      priority
      importance
      from {
        name
        email
        givenName
        familyName
      }
      to {
        name
        email
        givenName
        familyName
      }
      cc {
        name
        email
        givenName
        familyName
      }
      bcc {
        name
        email
        givenName
        familyName
      }
    }
    package {
      fileCount
      folderCount
      isEncrypted
    }
    observations {
      id
      type
      observable {
        id
        name
      }
      occurrences {
        type
        confidence
        startTime
        endTime
        pageIndex
        boundingBox {
          left
          top
          width
          height
        }
      }
      state
    }
    feed {
      id
      name
    }
    parent {
      id
      name
    }
    children {
      id
      name
    }
    collections {
      id
      name
    }
    workflow {
      id
      name
    }
  }
}

GraphQL variables:
{
  "id": "7e72b18c-899d-4e03-b484-6391e051203d"
}

GraphQL response:
{
  "type": "FILE",
  "mimeType": "text/plain",
  "fileType": "DOCUMENT",
  "fileName": "Metadata In Unstructured Data.txt",
  "fileSize": 1126,
  "masterUri": "https://graphlit20240221a3d8649b.blob.core.windows.net/files/7e72b18c-899d-4e03-b484-6391e051203d/Metadata%20In%20Unstructured%20Data.txt?sv=2023-11-03&se=2024-03-04T07%3A46%3A06Z&sr=c&sp=rl&sig=oj3aQ%2F3%2B7eZ9ONA1Gmrbvd5J2IfCRgSRYajz%2FHmo6d8%3D",
  "textUri": "https://graphlit20240221a3d8649b.blob.core.windows.net/files/7e72b18c-899d-4e03-b484-6391e051203d/Mezzanine/Metadata%20In%20Unstructured%20Data.json?sv=2023-11-03&se=2024-03-04T07%3A46%3A06Z&sr=c&sp=rl&sig=oj3aQ%2F3%2B7eZ9ONA1Gmrbvd5J2IfCRgSRYajz%2FHmo6d8%3D",
  "document": {},
  "children": [],
  "uri": "https://graphlitplatform.blob.core.windows.net/samples/Metadata%20In%20Unstructured%20Data.txt",
  "id": "7e72b18c-899d-4e03-b484-6391e051203d",
  "name": "Metadata In Unstructured Data.txt",
  "state": "FINISHED",
  "creationDate": "2024-03-04T02:21:30Z",
  "finishedDate": "2024-03-04T02:21:33Z",
  "workflowDuration": "PT3.1316993S",
  "owner": {
    "id": "196ba668-cf01-496d-bf41-18be461650dc"
  }
}

GraphQL response fields

The CLI responds to queries and mutations with a default set of GraphQL fields, but you can override the requested fields with the fields argument, such as:

g get --type content --id "{guid}" --fields "{ id name }"

Last updated