Skip to main content

File attachments

Overview​

The following endpoints enable users to add or remove an attachment within the Discloser's questionnaire-response.

Pre-requisites: Valid subscription key, organization UUID and question ID for the relevant attachment question in the respective Disclosure API environment.

Note – Question Type: Files can only be attached to questions with the ATTACHMENT type. Once attachments have been added, the file metadata is returned via the GET /response endpoint.

EnvironmentStepMethodURL
SandboxUploadPOSThttps://api.pre.cdpgreenstar.net/asp/response/response/file
ProductionUploadPOSThttps://api.cdp.net/asp/response/response/file
SandboxDeleteDELETEhttps://api.pre.cdpgreenstar.net/asp/response/response/file/{attachmentId}
ProductionDeleteDELETEhttps://api.cdp.net/asp/response/response/file/{attachmentId}

POST Request​

Details how to complete the POST request to add a file attachment to a question.

Note – Restrictions: File type and size restrictions apply to the POST request as in the CDP Response Portal:

  • Supported file types: PDF, DOCX, DOC, XLSX, XLS, CSV, PPT, PPTX
  • File size: 50 MB

Body​

FieldDescription
questionIdQuestion ID of a file attachment question.
fileValid file attachment (see above).
rowIdRow id if the attachment question is within a matrix question (currently all are within a matrix question).

Response​

Field table

FieldDescriptionData Type
idThe ID of the generated file within the response.integer
fileNameThe name of the file which was uploaded.string
fileSizeSize of the file attached.integer
fileTypeThe type of file which was uploaded.string
fileStatusThe status of the upload request.string

Schema

{
"id": integer,
"fileName": "string",
"fileSize": integer,
"fileType": "string",
"fileStatus": "string"
}

DELETE Request​

Details on how to complete the DELETE request to remove a file attachment from a question.

Parameters​

FieldDescriptionData Type
idThe ID of the uploaded file.integer

Response​

Field table

FieldDescriptionData Type
idThe ID of the generated file within the response.integer
fileNameThe name of the file which was uploaded.string
fileSizeSize of the file attached.integer
fileTypeThe type of file which was uploaded.string
fileStatusThe status of the upload request.string

Error handling​

1. Invalid file type​

When an invalid file type is entered, the following error is displayed:

{
"message": "The file is not supported",
"fileFormat": "application/json",
"supportedFileFormat": [
"PDF",
"CSV",
"DOCX",
"DOC",
"XLSX",
"XLS",
"PPTX",
"PPT"
],
"statusCode": 400,
"error": "Bad Request"
}

2. File is too big​

When a file that is too big is entered, the following error is displayed:

{
"message": "The file is too big",
"fileSize": 84696258,
"maxFileSize": 52428800,
"statusCode": 400,
"error": "Bad Request"
}