Views:

Contents

Summary

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.

 

Environment

Step

Method

URL

Sandbox

Upload

POST

https://api.pre.cdpgreenstar.net/asp/response/response/file

Production

Upload

POST

https://api.cdp.net/response/response/file

Sandbox

Delete

DELETE

https://api.pre.cdpgreenstar.net/response/response/file/{attachmentId}

Production

Delete

DELETE

https://api.cdp.net/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, PPTX, PPTXS

  • File size: 50Mb

Body

questionId: Question ID of a file attachment question.

file: Valid file attachment (see above).

rowId: Row id if the attachment question is within a matrix question (currently all are within a matrix question).

Response

Field table
 

Field

Description

Data Type

id

The ID of the generated file within the response.

integer

fileName

The name of the file which was uploaded.

string

fileSize

Size of the file attached.

integer

fileType

The type of file which was uploaded.

string

fileStatus

The 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
 

Field

Description

Data Type

id

The ID of the uploaded file.

integer

Response

Field table
 

Field

Description

Data Type

id

The ID of the generated file within the response.

integer

fileName

The name of the file which was uploaded.

string

fileSize

Size of the file attached.

integer

fileType

The type of file which was uploaded.

string

fileStatus

The 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"
}



If you have not found the answer you were looking for, please contact your Account Manager who will be able to assist you further.

Comments (0)
Add a comment