Skip to content

Commit 67a16fd

Browse files
fmontesfabrizzio-dotCMSvalentinogiardino
authored
Import Endpoints: Improve API Playground documentation (dotCMS#31970)
### Proposed Changes Improve the OpenAPI documentation for swagger ### Checklist - [ ] Tests - [ ] Translations - [ ] Security Implications Contemplated (add notes if applicable) ### Additional Info ** any additional useful context or info ** ### Screenshots Original | Updated :-------------------------:|:-------------------------: ** original screenshot ** | ** updated screenshot ** --------- Co-authored-by: fabrizzio-dotCMS <[email protected]> Co-authored-by: Valentino Giardino <[email protected]> Co-authored-by: valentinogiardino <[email protected]>
1 parent 55d6c84 commit 67a16fd

File tree

3 files changed

+213
-131
lines changed

3 files changed

+213
-131
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.dotcms.rest.api.v1.content.dotimport;
2+
3+
public class ContentImportDocs {
4+
5+
public static final String FORM_FIELD_DOC =
6+
"This endpoint accepts a `multipart/form-data` request with two fields:\n\n" +
7+
"| **Field** | **Type** | **Required** | **Description** |\n" +
8+
"|-----------|----------|--------------|-----------------|\n" +
9+
"| `file` | File | ✅ Yes | The CSV file to import. Must contain content rows and match the expected structure for the content type. |\n" +
10+
"| `form` | String | ✅ Yes | A JSON string containing the import parameters. See structure below. |\n\n" +
11+
"**`form` field structure:**\n\n" +
12+
"| **Property** | **Type** | **Required** | **Default** | **Description** |\n" +
13+
"|----------------------|------------|--------------|-------------|-----------------|\n" +
14+
"| `contentType` | String | ✅ Yes | – | Content Type variable or ID to import data into. |\n" +
15+
"| `language` | String | ❌ No | Default language | Language code (e.g., `en-US`) or language ID. |\n" +
16+
"| `workflowActionId` | String | ✅ Yes | – | Workflow Action UUID to apply to imported content. |\n" +
17+
"| `fields` | String[] | ❌ No | – | List of field variables or IDs used as keys for content updates. |\n" +
18+
"| `stopOnError` | Boolean | ❌ No | `false` | Whether to stop import on first validation error. |\n" +
19+
"| `commitGranularity` | Integer | ❌ No | `100` | Number of rows to commit in each transaction batch. |\n\n" +
20+
"**Example `form` value:**\n\n" +
21+
"```json\n" +
22+
"{\n" +
23+
" \"contentType\": \"webPageContent\",\n" +
24+
" \"language\": \"en-US\",\n" +
25+
" \"workflowActionId\": \"b9d89c80-3d88-4311-8365-187323c96436\",\n" +
26+
" \"fields\": [\"title\"],\n" +
27+
" \"stopOnError\": false,\n" +
28+
" \"commitGranularity\": 100\n" +
29+
"}\n" +
30+
"```";
31+
}

dotCMS/src/main/java/com/dotcms/rest/api/v1/content/dotimport/ContentImportParamsSchema.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import io.swagger.v3.oas.annotations.media.Schema;
44

5+
import javax.ws.rs.FormParam;
6+
57
/**
68
* Represents the schema for content import parameters used in Swagger documentation.
79
* <p>
@@ -12,6 +14,7 @@
1214
@Schema(description = "Schema for content import parameters.")
1315
public class ContentImportParamsSchema {
1416

17+
@FormParam("file")
1518
@Schema(
1619
description = "The CSV file to import.",
1720
type = "string",
@@ -20,6 +23,7 @@ public class ContentImportParamsSchema {
2023
)
2124
private String file;
2225

26+
@FormParam("form")
2327
@Schema(
2428
description = "JSON string representing import settings.",
2529
type = "string",
@@ -28,7 +32,7 @@ public class ContentImportParamsSchema {
2832
" \"contentType\": \"activity\",\n" +
2933
" \"language\": \"en-US\",\n" +
3034
" \"workflowActionId\": \"b9d89c80-3d88-4311-8365-187323c96436\",\n" +
31-
" \"fields\": [\"e1f99107-fd0e-49d4-a099-1cc10aa284d8\"]\n" +
35+
" \"fields\": [\"title\"]\n" +
3236
" \"stopOnError\":false \n" +
3337
" \"commitGranularity\": 100\n" +
3438
"}"

0 commit comments

Comments
 (0)