BuilderIO / builder

Drag and drop headless CMS for React, Vue, Svelte, Qwik, and more
https://builder.io/m/developers
MIT License
6.71k stars 832 forks source link

Builder content API does not return draft content when page is already published #3214

Open Andrzej-Schneider opened 1 week ago

Andrzej-Schneider commented 1 week ago

Describe the bug As in the title, builder content API: https://cdn.builder.io/api/v3/content/my-model-name?apiKey=YOUR_API_KEY does not return a proper draft content when page had been already published before and then content changed. Even with includeUnpublished=true in params image

 const req = await fetch(
      `${API_V3_CONTENT}/${modelName}/${contentId}?apiKey=${appState?.user?.apiKey}&cachebust=true&cacheSeconds=5&staleCacheSeconds=5&omit=endDate,startDate&enrich=true&includeUnpublished=true`,
    );

To Reproduce Steps to reproduce the behavior:

  1. create a new builder page add some custom components and click "Publish"
  2. get the content with the API call
  3. change some content on the page - edit some text values for example
  4. do not press "Publish Updates" but try to get the content again -> old content is being returned

Expected behavior New drafted content should be returned form API call

Screenshots Page with some content: Default: "Some text" image

Published: image

Getting content:

https://cdn.builder.io/api/v3/content/page/fad19f47b42c43378facada257f3b8e5_ee24ce9d39d1465c85a0e8359e0c0dde?apiKey=fad19xxxxxxxxxxxxxxxxxxxxx&cachebust=true&cacheSeconds=5&staleCacheSeconds=5&omit=endDate,startDate&enrich=true image

Changed content and not published updates: Default: "Some text - new content" image

https://cdn.builder.io/api/v3/content/page/fad19f47b42c43378facada257f3b8e5_ee24ce9d39d1465c85a0e8359e0c0dde?apiKey=fad19f47bxxxxxxxxxxxxxxxxx&cachebust=true&cacheSeconds=5&staleCacheSeconds=5&omit=endDate,startDate&enrich=true

Old content returned:

image

Additional context Add any other context about the problem here.

pkoroscik-se commented 1 week ago

I have the same problem :(