Forum Discussion

mfeltscher's avatar
11 years ago
Solved

Fetch inactive polls from REST API

Hi there

 

Is it somehow possible to get a list of all inactive polls using the REST API? There is a call to get the active polls (as documented here) so in my opinions it should be possible for inactive posts too.

 

 

Moreno

  • mfeltscher, you can get the list of all the polls in your community using the call, /restapi/vc/polls and then from the returned xml, you can parse the following node to get the active status of the poll. If it is false, the poll is inactive. 

     

    <active type="boolean">false</active>

     

    I hope this helps.

8 Replies

  • mfeltscher, you can get the list of all the polls in your community using the call, /restapi/vc/polls and then from the returned xml, you can parse the following node to get the active status of the poll. If it is false, the poll is inactive. 

     

    <active type="boolean">false</active>

     

    I hope this helps.

  • mfeltscher's avatar
    mfeltscher
    Expert
    11 years ago

    VarunGrazitti that is the way I'm doing it right now. I was afraid this could be the only way but not too surprised about it.. 

     

    I now have to fetch around 200 polls and filter them which is pretty slow as you can imagine. 

     

    Thank you anyways!

     

    Moreno

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)
    11 years ago

    Hi mfeltscher ,

     

    are you fetching the list from another website? if yes, you may consider to create an endpoint and leave all REST calls and filtering within the server. and there is only one call for you to retrieve the result via endpoint URL.

  • mfeltscher's avatar
    mfeltscher
    Expert
    11 years ago

    Hi HaidongG 

     

    No, these calls are made inside a custom component. I'm doing the filtering in there now.

     

     

    Moreno

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)
    11 years ago

    Hi mfeltscher ,

     

    if the rest operation is expensive, you may consider to cache the result, (one of the new features this year), such that it can only be calculated once in a short time window.