How to Save an Attachment in HeavyJob

This tutorial will walk you through how to save an attachment in HeavyJob. These files are used in several places, including the Daily Digest and Photos & Docs tool.

Prerequisites

Before starting, ensure you have the following:

  • Access to HeavyJob & Attachments APIs.
  • An API Client (Client ID and Secret) used to generate an authentication token for API utilization.
  • API Client must possess necessary Heavyjob and Attachments scopes: attachments:read attachments:write
📘

Refer to the Getting Started with Request Tokens guide for details on how to authenticate.

Files in HeavyJob are organized by the businessUnitId, jobId, foremanId, and transactionDate values. You will need all four values to save a file in HeavyJob.

You may use the following three endpoints to acquire the businessUnitId, jobId, foremanId values. You will create the transactionDate value yourself. The expected date format is listed further on in this section..

BusinessUnitId
🔄

Acquire a BusinessUnitId from the HeavyJob GET Business Units endpoint.

JobId
🔄

Acquire a JobId from the HeavyJob GET Jobs endpoints.

ForemanId
🔄

Acquire a ForemanId from the HeavyJob GET Employees in a Business Unit endpoint.

TransactionDate

You will create this value in the request body.

The expected date format is "Year-Month-Day", an example is provided below.

"transactionDate": "2025-03-24"

Step 1: Upload the File Using the Attachments API

The Attachments API is used to upload, store, download, and share files across HCSS products.

🔄

To upload a file, make a request to the Attachments API POST Files endpoint.

🚧

WARNING

You must provide the BusinessUnitID, JobID, and upload a file.

ℹ️

ATTENTION

The fileId value you need for the next step will be given in the response of this request. Please keep it ready.

Step 2: Link the Uploaded File to HeavyJob

Files are saved in HeavyJob by associating the file to a foreman for a given date and job.

🔄

This is done by sending a request to the HeavyJob POST Attachment endpoint.

You must fill in the transactionDate, jobId, foremanId fields in the request body using the values derived from the prerequisite section.

The fileId field should be filled in with the value given by the step1 response.

You may optionally include a note for each attachment, to help users understand the origin or context of the file.

A successful association will return a 201 Created response.