Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCU-2672

Examples for Non-Page Nodes

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Neutral
    • None
    • None
    • None
    • None

    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!

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              mdrapela Martin Drápela
              nlovas Nicole L
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: