Forum Discussion

Inactive User's avatar
Inactive User
7 years ago

How does the VIEW ALL DRAFTS blog page get the drafts (if there's no way to get drafts in the API)?

I'm trying to show drafts by various authors to our blog manager, and it seems there's literally no way to do this ... however, since the Blog Dashboard itself has the option to SHOW ALL DRAFTS, there's obviously some way to do this, i.e,. https://community.XXX.com/t5/blogs/blogconsolepage/blog-id/xxx-blog/tab/drafts 

 

SO... how does that link do it, and how can I approximate that? It seems the only way to get the drafts is as the author, in the UI; so how can I do that via LiQL or the V1 API? The functionality obviously exists for that page to get it...

Think creatively please. I've seen many responses that say "it's not possible," but I'd like to hear imaginative workarounds. I've seen requests for this back to 2011 ... so... help a dev out, please. 

 

Thanks!

 

VikasB @VarunGrazitti Fellsteruk or ClaudiusH any of you have any insight?

8 Replies

  • Hey, 

    Sadly i may not be much use... This is also a frustration that i have however ive not got to the volume of blogging that its a big issue, one of the things my dev suggested but didnt actually give a technical solution was a custom page they could build to surface everything, sadly the blog and TKB workflow are not amazing but ClaudiusH may have some thoughts... 

     

    Sorry

  • Inactive User's avatar
    Inactive User
    7 years ago

    AndrewF SuzieH ClaudiusH VikasB Can you folks give any input on this? 

    I'm trying to create *some* form of blog manager board for our blog manager, who is frustrated by the lack of one OOTB. I know SMM offers this, so I'm hoping there is some hook I can use to get the same info. We don't need SMM, since we already use other tools for Social Media. All we'd like is a blog dashboard for the editor. 

    However, as far as I can tell there's no ability to use LiQL to get draft status articles, especially if they're not your own. For example,

    is_draft

    is only available for Create and Update, not a Query (Read). 

    When a post is in draft, it doesn't seem to be able to be accessed by LiQL, either. It just doesn't show up. For example, this returns no rows even though I just saved a post to draft with that author id:

    SELECT * FROM messages WHERE author.id = '30'

    Returns:

    {
      "status" : "success",
      "message" : "",
      "http_code" : 200,
      "data" : {
        "type" : "messages",
        "list_item_type" : "message",
        "size" : 0,
        "items" : [ ]
      },
      "metadata" : { }
    }

    However, if I switch to the user (id=30) and look for the post id in the Canonical Url field, I can get the post ID, and when I search for that with LiQL, it returns the record. 

    SELECT * FROM messages WHERE id = '7833'
    
    Returns 1 record (leaving out results for sake of space)

     

    Maybe I can set up a subscription for whenever a post is created and get the message.id from that? However, those instructions are fairly confusing. And where would I store the list of new posts? Can I set up a server-side array? 

    Whatever the method to get there:

    How can I use LiQL to generate ANY approximation of a manager board for our blog manager where I can display other authors' draft articles so she can review them before publishing happens? 

    I'm stuck and can't find anything to truly help solve this on the boards or documentation. 

    Happy to use API v1 or v2, hacks, pretzel logic, sorcery, or anything else. I'm asking you guys to think out of the box, please.  

    I know it likely "can't be done" using normal means. Please offer suggestions of how I might make it happen. For example, how does the VIEW ALL DRAFTS get the drafts? Thanks!

     

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    7 years ago

    Inactive User, let me know if this approach might work for you.

    Try the Community API v1 call for topics/recent. It supports returning messages that are in draft state. The call (using session key authentication) would be:

    /restapi/vc/boards/id/<board-id>/topics/recent?visibility.scope=draft&restapi.session_key=<auth-token>

    Note that only permissible users are able to see drafts as configured in user permissions for the given node. Furthermore, this will only work for drafts in Blogs and TKBs which are different than the autosave messages available on other interaction styles. 

    This REST API endpoint supports the following query parameters and possible values: 

    • moderation.scope
      • approved
      • rejected
      • unmoderated
      • marked_undecided
      • marked_approved
      • marked_rejected
      • all_unmoderated
      • mod_private
      • approved_and_all_unmoderated
      • level2_unmoderated
      • moderation_with_reason_code
    • visibility.scope
      • public
      • public_moderateable
      • draft
      • on_hold
      • rejected
      • unmoderated
      • marked_undecided
      • marked_approved
      • marked_rejected
      • deleted
      • disabled
      • personal
      • friends_only
      • public_and_draft
      • private
      • not_deleted
      • all
      • none
      • public_and_unmoderated
      • all_moderated
      • mod_private
      • moderator
      • published
    • revision.state
      • any
    • show_hidden
      • true
      • false

      

  • Inactive User's avatar
    Inactive User
    7 years ago

    Thanks SuzieH I'll look into this. 

    I don't see permissions for viewing or editing drafts in Blogs, only Knowledge Base articles. 

    Can admins see the drafts of authors in the blogs? I haven't been able to make this happen so far. 

     

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    7 years ago

    Hi Inactive User. Check out the Manage any article and Manage own articles permissions under Blog Articles. I believe those two permissions include the ability to see drafts inherently. I have the Blog Author role for the Lithium Community, for example for the Release Notes blog. I am able to see my own drafts, but not others' drafts. I believe only the author of a blog is able to access/edit their drafts.

  • Inactive User's avatar
    Inactive User
    7 years ago

    Thanks, yes, it seems that's the issue, which is a problem for a good blogging workflow for us (so far). I'll lyk if I find a good workaround. I figure if SMM can do it, why can't I?  Thoughts?

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    7 years ago

    I, myself, don't have any useful thoughts here. The Developer Discussion forum is probably your best bet.

  • This is one of the reasons why bundling permissions is counter-productive for users. I have made this point before. Community admins should have access to many more discrete permissions, and be able to create their own bundles. For example, a bundle of permissions would be a role, and a role should be able to bundle other roles. The algorithm for this already exists under ranking.

    If the "view drafts" permission is a standalone for TKB, then the algorithm exists, and it should be simple to port it over to blog permissions. I believe I put this in a product idea some time ago.