Adding Documents

Datasaur supports adding documents into an existing project, as described here.

In this section, we'll be running through how to do this programmatically via our API, specifically through GraphQL mutation addDocumentsToProject.

  1. Make sure you have generated your OAuth Credentials. These are crucial for authenticating and gaining access to the API capabilities.

  2. Prepare the GraphQL payload which will be used for the API request. Below you will find a simplified version of the payload required for adding documents to a project. You can access the complete reference here.

  3. Send the GraphQL request to submit your request. Upon successfully submitting your mutation, you will receive a Job ID. This ID can be used to monitor the progress.

{
  "operationName": "AddDocumentsToProjectMutation",
  "query": "mutation AddDocumentsToProjectMutation($input: AddDocumentsToProjectInput!) {\n  result: addDocumentsToProject(input: $input) {\n    job {\n      ...JobFragment\n      __typename\n    }\n    name\n    __typename\n  }\n}\n\nfragment JobFragment on Job {\n  id\n  status\n  progress\n  errors {\n    id\n    stack\n    args\n    __typename\n  }\n  resultId\n  createdAt\n  updatedAt\n  result\n  additionalData {\n    documentIds\n    __typename\n  }\n  __typename\n}\n",
  "variables": {
    "input": {
      "documents": [
        {
          "document": {
            "name": "<FILENAME>",
            "objectKey": "<PATH_TO_FILE>"
          }
        }
      ],
      "projectId": "<PROJECT ID>"
    }
  }
}

The documents structure follows the same format as used in the createProject mutation. Read more here for document details.

Currently, we don't have an example API client. If you require more personalized support or guidance, please reach out to us at support@datasaur.ai.

Last updated