Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Dynamicweb API - Paragraphs

Dynamicweb API - Paragraphs

Natan Ólafsson
Natan Ólafsson
Reply

Hello

When requesting paragraph data from the dwapi [/dwapi/content/paragraphs], if the page is a visual editor page then there seems to be no way to determine what rows the paragraphs belong to.

For example, currently the json response is as follows:

[{
        "ID": 1,
        "Name": "Box One",
        "Item": {
            "Fields": []
        }
    },
    {
        "ID": 2,
        "Name": "Box Two",
        "Item": {
            "Fields": []
        }
    },
    {
        "ID": 3,
        "Name": "Portrait One",
        "Item": {
            "Fields": []
        }
    },
    {
        "ID": 4,
        "Name": "Portrait Two",
        "Item": {
            "Fields": []
        }
    }
]

 

We have no way to know where the first row ends and the second begins.
Would it be possible to group the paragraphs together?

[{
    "ID": "row-boxes",
    "Name": "Boxes row",
    "ItemType": "row_boxes_item_type",
    "Paragraphs": [{
        "ID": 1,
        "Name": "Box One",
        "Item": {
            "Fields": []
        }
      },
      {
        "ID": 2,
        "Name": "Box Two",
        "Item": {
            "Fields": []
        }
      }
    ]
  },
  {
    "ID": "portrait-boxes",
    "Name": "Portraits row",
    "ItemType": "row_portraits_item_type",
    "Paragraphs": [{
        "ID": 3,
        "Name": "Portrait One",
        "Item": {
            "Fields": []
        }
      },
      {
        "ID": 4,
        "Name": "Portrait Two",
        "Item": {
            "Fields": []
        }
      }
    ]
  }
]

 

Regards
Natan


Replies

 
Nicolai Pedersen
Reply

Hi Natan

Currently not. Rows are layout, and these endpoints are more thought of as data endpoints with the rendering and layout handled by the head - which is your js app.

Can you explain the use case - do you use the visual content builder with regular templates for content authoring and then 're-render' them in the frontend or what is the thought? Kind of a dual head solution?

It is of course possible to return the rows - we just want to understand how you want to use it.

Thanks for clarifying!

BR Nicolai

 
Natan Ólafsson
Natan Ólafsson
Reply

The idea is to use the visual editor only for ordering & configuring components/paragraphs.
So if you want to display three "information boxes" on the frontpage, you can use the visual editor to create the row and add the boxes and configure each box individually. But the visual editor will only display gray boxes and not actually render the text/image/button/etc, in order to avoid as much html duplicaton between the js frontend and the dynamicweb html templates.

Its a comprimise, so we can still have a js frontend but have some user-friendly visual editor functionality. All of the css would be defined in the js frontend and the DW master page would reference that css file in order to avoid duplication. I am personally a really big fan of the visual editor, so I am trying to find a way to have it work, even with a js frontend.

 

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Ok, thanks for clarifying - it makes sense. So basically you just need the data and structure of the rows and paragraphs.

Will try to look into it. Expect a little time, week or 2, before we can deliver though.

BR Nicolai

Votes for this answer: 1
 
Natan Ólafsson
Natan Ólafsson
Reply

Awesome, thanks. :) 

 

You must be logged in to post in the forum