Hi,
I'm trying to create a Page, With GridRows and Paragraphs via the management API. Could it be that the GridRowCreate only works correctyly in a visualeditor context?
That is what my AI helper suggests per the analyses below:
GridRowCreate Management API — Non-functional Outside Visual Editor
## Summary
The `POST /admin/api/GridRowCreate` endpoint (command `Dynamicweb.Content.UI.Commands.VisualEditor.GridRowCreateCommand`) **always fails with HTTP 500** when called via the Management API. Two distinct bugs prevent it from working:
| # | Error | Trigger | Cause |
|---|-------|---------|-------|
| **Bug 1** | `ArgumentException: String value cannot be empty` | `GridId` not provided or incorrect | The command does not read `GridId` from the request payload; it tries to resolve it from the page's Layout object, which returns empty |
| **Bug 2** | `ArgumentOutOfRangeException: Index must be within the bounds of the List` | `GridId` correctly set to `"Page"` | The command tries to `List.Insert()` into the Visual Editor's in-memory row collection, which does not exist in the API context |
The endpoint is documented in the OpenAPI spec (`/admin/api/api.json`) and accepts all the correct parameters, but the underlying `GridRowCreateCommand` is a Visual Editor command that depends on server-side session state unavailable via the Management API.
## Environment
- **DynamicWeb 10** with **Swift 2.1** (Update 2.2)
- Tested on **two independent instances** — both fail identically
- Reproducible on **any page** — with or without existing grid rows
- Grid definition files are present on disk (`/Files/Templates/Designs/Swift-v2/Grid/Page/RowDefinitions/*.json`)
## API Spec (from `/admin/api/api.json`)
The `GridRowCreate` endpoint is documented with the following request model:
```json
{
"PageId": 0, // integer — target page ID
"GridId": "", // string — grid identifier within the layout
"DefinitionId": "", // string — row definition (e.g. "1Column")
"TemplateId": 0, // integer — optional row template ID
"Container": "", // string — optional container reference
"SortIndex": 0 // integer — insertion position
}