Uploading files to ProofHub is a two step process:
- Create the attachment, receive a attachment id verifying the upload was successful.
- Attach the file to a topic, comment, task or file section. See the following endpoints for attaching:
POST https://<company-url>.proofhub.com/files/upload.php
uploads a file. The request body should be the binary data of the attachment. Make sure to set the Content-Type header. Replace company-url in the request with your ProofHub account URL.
1. First, you need to get the file ID using the request URL:
POST https://<company-url>.proofhub.com/files/upload.php
In the headers, you need to pass the x-api-key and in the body (form data) you need to pass the project id and upload the file as:
project_id:<project id>
file:<select the file>
In the response of this request, you'll get the "file_id".
2. The next step is to attach the file with the help of "file_id" you have received.
The request URL would be,
POST /api/v3/projects/<project_id>/folders/<folder_id>/files
Headers:
x-api-key
Content-type:Application/JSON
```json
{
"folder": <folder id>
"attachments": <file_id>
}
If the folder parameter is not specified, the file will be uploaded in the project home folder.