Forum Discussion

koushikniranjan's avatar
3 years ago

Idea Exchange Status and Comment Update via ReST API

We are looking for an option to programatically update Status of an Idea (In Idea Exchange page) and add a new comment to an idea by ReST API call. Is this possible?  We have hundreds of Ideas tha...
  • Akenefick's avatar
    3 years ago

    Hi koushikniranjan  We recently did something similar and I found this thread very helpful. Solved: How do I change the status of an idea? - Atlas (khoros.com)

     

    To summarize the API calls I used:

    First to retrieve the list of ideas we were looking for ideas that were a certain age and had below a threshold of votes. You can customize this with your own constraints found here messages (khoros.com)

     

     

    api/2.0/search?q=SELECT id FROM messages WHERE depth=0 AND board.id ="[boardID here]" AND kudos.sum(weight) < [kudos here] AND post_time > [date1] AND post_time < [date2] AND status.key="[ideaStatus here]" LIMIT 1000

     

     

    Next I used the following call to change the status of an idea (Thanks to DougS for this one)

     

    restapi/vc/messages/id/[message id here]/message_status/set?message.status=/message_statuses/key/[status key here]

     

     

     

    When you change the status it will post a comment to the idea that says what the status was changed to . However, we wanted to add our own message explaining the reason for the change. So I used the following two calls to first get the newest comment on the idea (which should be the status change comment) and second to edit that comment with our message. (Thanks to PerBonomi whose idea this was)

     

    api/2.0/search?q=SELECT id FROM messages WHERE topic.id = '[id]' AND depth > 0 LIMIT 1
    restapi/vc/messages/id/[comment id]/edit?message.body='your message here'

     

     

  • Akenefick's avatar
    Akenefick
    3 years ago

    I tried updating a status and then editing the comment with an unverified account. It allowed me to update the status but prevented me from editing the comment. Is the account you are using unverified? You can set it to verified at the bottom of the user profile page.