Search

Documents are revisioned files that are stored in Administrate. They can be associated with several entities (Accounts, Contacts, Opportunities, Events, LMS Resources...) and can be organized by storing them in specific Folders.

Folders

The following query fetches the first page of all folders whose name contains doc:

Example

query folders{
  folders(filters:[
    {field: name, operation: like, value: "%doc%"}
  ]){
    edges{
      node{
        id 
        name
        documents{
          edges{
            node{
              name
            }
          }
        }
      }
    }
  }
}

The response contains the first page of documents for each folder:

{
  "data": {
    "folders": {
      "edges": [
        {
          "node": {
            "id": "Rm9sZGVyOjk2MQ==",
            "name": "Opportunity Documents",
            "documents": {
              "edges": []
            }
          }
        },
        {
          "node": {
            "id": "Rm9sZGVyOjk2Mg==",
            "name": "Account Documents",
            "documents": {
              "edges": []
            }
          }
        },
        {
          "node": {
            "id": "Rm9sZGVyOjk2Mw==",
            "name": "Contact Documents",
            "documents": {
              "edges": []
            }
          }
        },
        {
          "node": {
            "id": "Rm9sZGVyOjk2NA==",
            "name": "Event Documents",
            "documents": {
              "edges": [
                {
                  "node": {
                    "name": "course-introduction.pdf"
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

For the full range of available filters see our FolderTypeField API Reference.

Documents

The following query fetches the first page of all documents in the specified folder and with the word introduction in their name

Example

query documents{
  documents(filters:[
    { field: name, operation: like, value: "%introduction%" }
    { field: folderId, operation: eq, value: "Rm9sZGVyOjk2NA==" }
  ]) {
    edges {
      node {
        id
        name
        latest{
          id
          status
          fileSizeStr
          originalExtension
          revisionNumber
        }
      }
    }
  }
}

The response shows the latest revision details

{
  "data": {
    "documents": {
      "edges": [
        {
          "node": {
            "id": "RE1TRG9jdW1lbnQ6OA==",
            "name": "course-introduction.pdf",
            "latest": {
              "id": "RE1TRG9jdW1lbnRSZXZpc2lvbjoyMjM2",
              "status": "ready",
              "fileSizeStr": "120066",
              "originalExtension": "pdf",
              "revisionNumber": 0
            }
          }
        }
      ]
    }
  }
}

For the full range of available filters see our DocumentField API Reference.