Search code examples
apostropheapostrophe-cms

Using apostrophe-blog with apostrophe-headless


I've been digging in and for some reason when I attempt to add the restApi value to the apostrophe-blog config, I'm not getting anything from the api. Apostrophe-blog is an extension of apostrophe-pieces, I'm wondering what I'm missing. Is this not intended to work in this fashion? Hoping this can be answered really easily.

Here is what's currently inside my modules object of my app.js:

'apostrophe-headless': {},
'apostrophe-blog': {
  addFields: [
    {
      name: 'body',
      label: 'Page Content',
      type: 'area',
      options: {
        widgets: {
          'apostrophe-rich-text': {
            toolbar: [ 'Styles', 'Bold', 'Italic', 'Link', 'Unlink', 'Anchor', 'Table', 'BulletedList', 'Blockquote', 'Strike',  'Subscript', 'Superscript' ]
          },
          'apostrophe-images': {},
          'apostrophe-video': {},
          'headline': {},
          'pullquote': {},
        }
      }
    }      
  ],
  restApi: true 
},
'apostrophe-blog-pages': {},
'apostrophe-blog-widgets': {},  

Solution

  • I discovered the easy answer I was looking for. After duping, and extending the apostrophe-blog module and reading through the code and commenting bit out to debug, I realized that the future filter was necessary. That being said the solution was to tack the future request param to the end of the api request for blog articles. But it works! Now back to adding more fun widgets.

    /api/v1/apostrophe-blog?future=false