Pro
  • Set theme to dark (⇧+D)
    Pro

    How to attach files to a task field using the API

    Welcome to Tallyfy! If you’re wondering how to attach files to a task field, you’re in the right place. There are two ways you can do it - locally or externally.

    Important - if you make API calls directly to the Tallyfy API endpoint, you must supply an additional header in your requests X-Tallyfy-Client: APIClient otherwise your requests will be dropped.

    ​​ Local File Attachment

    To attach a local file, follow these simple steps:

    1. Use an API client like Postman to upload the file to our file system/storage. Make a POST request to this URL: https://api.tallyfy.com/organizations/your-organization-id/file, using “form-data” as the request type.

    2. Provide the following key-value pairs in the request body:

      • “name”: Upload your file here.
      • “uploaded_from”: Add your Organization ID.
      • “subject_type”: Add the text “Run” here.
      • “step_id”: Add the Step ID.
      • “checklist_id”: Add the Checklist ID.
      • “subject_id”: Add the Run ID.

      Make sure to set the request header “Accept” to “application/json, text/plain, /” and include your auth bearer token.

    3. You’ll receive a response with the file data (Let’s call it fileData).

    4. Attach the file data to the task field. Make a PUT request to this URL: https://api.tallyfy.com/organizations/your-organization-id/runs/run-id-here/tasks/task-id-here.

    5. Use the following request payload:

      {
        "taskdata": {
          "capture_id_here_(field_id)": [
            fileData.data
          ]
        }
      }
      

      Again, don’t forget to include your auth bearer token in the request headers.

    By following these steps, you’ll be able to attach a file to a task field easily.

    ​​ External File Attachment

    If you want to attach an external file, the process is even simpler:

    1. Attach the file data to the task field. Make a PUT request to the same URL mentioned above.

    2. Use the following request payload:

      {
        "taskdata": {
          "capture_id_here_(field_id)": [
            {
              "filename": "file_name_here",
              "source": "url",
              "subject": {
                "id": "run_id_here",
                "type": "Run"
              },
              "uploaded_from": "org_id_here",
              "url": "external_file_URL_here"
            }
          ]
        }
      }
      

      Don’t forget to include your auth bearer token in the request headers.

    That’s it! By following these steps, you’ll be able to attach files to task fields effortlessly. If you have any questions, feel free to reach out to us. We’re here to help!