Skip to main content

Files

The Digital Product Passport Template Files API allows you to manage the lifecycle of template files, including creating, viewing, updating, and deleting template files.

A template files allows you to upload file, with name and description, to the DPP object.

Upload Template File

1. Create Template File

POST /create-template-file

Request Body

{
"template_id": "uuid",
"file": "file object",
"modelId": "uuid",
"name": "string",
"description": "string",
"company_id": "uuid"
}

Response

StatusDescription
200 OKTemplate file created successfully with the signed URL.
400 Bad RequestInvalid file format in the request body.
500 Internal Server ErrorAn unexpected error occurred during the template file creation.

Response Object

{
"message": "Template file created successfully",
"ok": true,
"file": {
"id": "uuid",
"template_id": "uuid",
"name": "string",
"description": "string",
"path": "string",
"type": "string",
"uuid": "uuid",
"created_at": "string",
"signedUrl": "string"
}
}

2. View Template Files

GET /view-template-files/:templateId

Response

StatusDescription
200 OKSuccessfully retrieved the list of template files.
500 Internal Server ErrorAn unexpected error occurred while fetching the template files.

Response Object

{
"files": [
{
"id": "uuid",
"template_id": "uuid",
"name": "string",
"description": "string",
"path": "string",
"type": "string",
"uuid": "uuid",
"created_at": "string"
}
]
}

3. View Template File

GET /view-template-file/:templateId/file/:fileId

Response

StatusDescription
200 OKSuccessfully retrieved the template file with its signed URL.
500 Internal Server ErrorAn unexpected error occurred while fetching the template file.

Response Object

{
"file": {
"id": "uuid",
"template_id": "uuid",
"name": "string",
"description": "string",
"path": "string",
"type": "string",
"uuid": "uuid",
"created_at": "string",
"signedUrl": "string"
}
}

4. Update Template File

PUT /update-template-file/:templateId/file/:fileId

Request Body

{
"file": "file object (optional)",
"modelId": "uuid",
"name": "string",
"description": "string",
"company_id": "uuid"
}

Response

StatusDescription
200 OKTemplate file updated successfully with new information and signed URL.
400 Bad RequestInvalid file format in the request body.
406 Not AcceptableThe specified template file is missing or not found.
500 Internal Server ErrorAn unexpected error occurred while updating the template file.

Response Object

{
"message": "Template file updated successfully",
"ok": true,
"file": {
"id": "uuid",
"template_id": "uuid",
"name": "string",
"description": "string",
"path": "string",
"type": "string",
"uuid": "uuid",
"updated_at": "string",
"signedUrl": "string"
}
}

5. Delete Template File

DELETE /delete-template-file/:templateId/file/:fileId

Response

StatusDescription
200 OKTemplate file deleted successfully from the database and storage.
500 Internal Server ErrorAn unexpected error occurred while deleting the template file.

Response Object

{
"message": "Template file deleted successfully",
"ok": true
}