[DOCU-2672] Examples for Non-Page Nodes Created: 07/Mar/23 Updated: 09/Mar/23 Resolved: 09/Mar/23 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Nicole L | Assignee: | Martin Drápela |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation page URL: | https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Nodes-and-properties-APIs/Nodes-API.html#_put |
| Reporter Name: | Nicole |
| Email: | nlovas@ualberta.ca |
| Description |
|
I'm tasked with moving a series of pages from another CMS into Magnolia. I'd like to use the Nodes API to create these pages. Using curl, I was successfully able to create a page. Next, I need to add a component to an area on the page. (Using a seperate API call as this API can only create one node per call) But nothing I have tried has been able to get anywhere except "Invalid path" as a response. Can you please add documentation for adding non-page nodes? Eg, I am trying to add a banner component called "header-banner" to the banner area on the page I just created:
curl http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/website/home/connect/media-hub/unfeatured/blog-posts/test/banner \
-H "Content-Type: application/json" \
-X PUT -i \
--user superuser:superuser \
--data \
'
{
"name":"header-banner",
"type":"mgnl:component",
"path":"/home/connect/media-hub/unfeatured/blog-posts/test/banner/0",
"properties":[
{
"name":"mgnl:template",
"type":"String",
"multiple":false,
"values":[
"main-website:components/banner/header-banner"
]
},
{
"name":"background",
"type":"String",
"multiple":false,
"values":[
"recessed grey"
]
},
{
"name":"noBreadCrumb",
"type":"Boolean",
"multiple":false,
"values":[
false
]
}
]
}
'
Surely this is possible with this API, but I'm not sure how and the documentation only gives examples for creating a page. Thanks! |
| Comments |
| Comment by Martin Drápela [ 09/Mar/23 ] |
|
Added an new example for adding a component to an area. |