Forum Discussion

micha80's avatar
micha80
Expert
10 years ago

Unmoderated messages between a given timerange

Hi all,

 

I want to receive a list of unmoderated messages within a given timerange. The list of messages should also be filtered by a given board_id

 

Actually I am using the following code:

 

<#assign queryString = "/messages/moderation/required" />
<#if boardIsGiven == true>
<#assign queryString = "/boards/id/" + givenBoardId + "/messages/moderation/required" />
</#if>
<#assign unmoderatedMessages = apiCall("1", queryString) />

 

The apiCall function is just a wrapper and internally calls the normal "restadmin" function.

 

This works fine for me. But now I am searching for a way to add a timerange as a parameter. I found parameters like "date_start" and "date_end" but there are not recognized by the call. When I write the wrong format into these parameters an error occurs which let me think they are recognized. But I was wrong.

 

Then I found some posts which tried to use the search API functionality and the parameter "date:[1341341612 TO 1341946412]" at the end. But the search API has not the option to filter by unmoderated messages.

 

Now I am stuck and hope that there is an other solution to solve my problem.

 

Short question: Is there a way to get a paginationable message list which is optionaly filtered by moderation status, board_id and timerange?

 

Regards,

Michael

  • I would like to recommend you use a LiQL query to get the messages you are looking for, but we unfortunately do not have support for filtering messages by moderation status in LiQL yet.  Until that is available, it is possible to do a REST V1 message search with a query like the following as the value of the q parameter:

     

     

    moderationStatus:unmoderated AND board_id:studio AND date:[1341341612 TO 1341946412]

    The values you can choose for moderationStatus are:

     

    • unmoderated
    • flagged
    • approved
    • rejected
    • marked_undecided
    • marked_approved
    • marked_rejected

    (for the most part, I think you only need to use the first 4 moderation statuses above.  I'm not quite clear what the last 3 are for)

     

    You could also scope your search to a specific board rather than include the board_id field in your query.

     

    -Doug

  • DougS's avatar
    DougS
    Khoros Oracle

    I would like to recommend you use a LiQL query to get the messages you are looking for, but we unfortunately do not have support for filtering messages by moderation status in LiQL yet.  Until that is available, it is possible to do a REST V1 message search with a query like the following as the value of the q parameter:

     

     

    moderationStatus:unmoderated AND board_id:studio AND date:[1341341612 TO 1341946412]

    The values you can choose for moderationStatus are:

     

    • unmoderated
    • flagged
    • approved
    • rejected
    • marked_undecided
    • marked_approved
    • marked_rejected

    (for the most part, I think you only need to use the first 4 moderation statuses above.  I'm not quite clear what the last 3 are for)

     

    You could also scope your search to a specific board rather than include the board_id field in your query.

     

    -Doug

    • micha80's avatar
      micha80
      Expert

      Hi DougS,

       

      thanks for the reply. First try out is working well!

       

      Regards,

      Michael