diff --git a/reference/ATTACHMENTS/_order.yaml b/reference/ATTACHMENTS/_order.yaml index bbe2c04..72739aa 100644 --- a/reference/ATTACHMENTS/_order.yaml +++ b/reference/ATTACHMENTS/_order.yaml @@ -3,4 +3,5 @@ - get-single-attachment - create-attachment - finalize-attachment +- copy-all-attachments - delete-attachment diff --git a/reference/ATTACHMENTS/copy-all-attachments.md b/reference/ATTACHMENTS/copy-all-attachments.md new file mode 100644 index 0000000..252459b --- /dev/null +++ b/reference/ATTACHMENTS/copy-all-attachments.md @@ -0,0 +1,45 @@ +--- +title: Copy All Reference Files +excerpt: >- + Copy all reference files from one form to another. +api: + file: rest-api.json + operationId: copy-all-attachments +deprecated: false +hidden: false +metadata: + title: '' + description: '' + robots: noindex +next: + description: '' +--- + +This endpoint allows you to copy all reference files from a source form to a destination form. This is useful when cloning a form or moving reference data between applications. + +# Request Payload + +```json +{ + "source_parent_id": "93eb5194-472e-436f-8769-6554b5f8845c", + "destination_parent_id": "842d5194-472e-436f-8769-6554b5f8845c", + "parent_type": "form" +} +``` + +# Response + +The response includes a mapping of the original attachment IDs to the new attachment IDs created during the copy process. + +```json +{ + "ref_file_mapping": { + "ef9bc6b0-cfd2-4c3a-8189-316f1335126a": "694e1ea7-f847-4fe3-a8bb-299c50e0e6ed" + } +} +``` + +# Limits + +- **100 reference files** per form. +- **1GB** total reference file size per form. diff --git a/reference/rest-api.json b/reference/rest-api.json index 0a34228..d28d05a 100644 --- a/reference/rest-api.json +++ b/reference/rest-api.json @@ -511,6 +511,44 @@ }, "description": "Location metadata captured at creation or update time." }, + "AttachmentCopyAllRequest": { + "type": "object", + "required": [ + "source_parent_id", + "destination_parent_id", + "parent_type" + ], + "additionalProperties": false, + "properties": { + "source_parent_id": { + "type": "string", + "description": "The ID of the source parent (e.g. form ID) to copy reference files from" + }, + "destination_parent_id": { + "type": "string", + "description": "The ID of the destination parent (e.g. form ID) to copy reference files to" + }, + "parent_type": { + "type": "string", + "description": "The type of the parent resource", + "enum": [ + "form" + ] + } + } + }, + "AttachmentCopyAllResponse": { + "type": "object", + "properties": { + "ref_file_mapping": { + "type": "object", + "description": "A mapping of original reference file attachment IDs to their new copies", + "additionalProperties": { + "type": "string" + } + } + } + }, "AttachmentCreateRequest": { "type": "object", "required": [ @@ -10211,6 +10249,88 @@ "deprecated": false } }, + "/v2/attachments/copy_all": { + "post": { + "summary": "Copy all reference files", + "description": "Copy all reference files from one form to another. Limits: 100 reference files per form, 1GB total per form.", + "operationId": "copy-all-attachments", + "parameters": [ + { + "name": "x-apitoken", + "in": "header", + "description": "API Token. Required to authenticate the request.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AttachmentCopyAllRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AttachmentCopyAllResponse" + } + } + } + }, + "400": { + "description": "400", + "content": { + "application/json": { + "examples": { + "Result": { + "value": "{\n \"error\": \"Bad Request\"\n}" + } + }, + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Bad Request" + } + } + } + } + } + }, + "401": { + "description": "401", + "content": { + "application/json": { + "examples": { + "Result": { + "value": "{\n \"error\": \"Unauthorized\"\n}" + } + }, + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Unauthorized" + } + } + } + } + } + } + }, + "deprecated": false + } + }, "/v2/attachments/finalize": { "post": { "summary": "Finalize Attachment",