Forum Discussion

PerBonomi's avatar
10 years ago

How do I change the status of an idea?

Hi there, I'm trying to use the API to change the status of an idea, but I keep getting errors.

/restapi/vc/messages/id/609/message_status/ shows me these results:

<response status="success">

 <message_status type="message_status" href="/message_statuses/id/9">

  <name type="string">New Idea</name>

  <key type="string">newidea</key>

  <id type="int">9</id>

 </message_status>

</response>

 

When I try $.post("/restapi/vc/messages/id/609/message_status/set?key=duplicate&name=Duplicate&id=19"); I get error 511 A required query string argument is missing.

When I try $.post("/restapi/vc/messages/id/609/message_status/key/set?value=duplicate"); I get error 501 Unknown path element at node &apos;message_status.key&apos;.

 

Has anyone successfully done this?

  • DougS's avatar
    DougS
    10 years ago

    I think I see the issue -- my last example was not quite correct.  First, you need to add the message status via the idea exchange admin (if you have not done so already) -- go to the SYSTEM -> Statuses -> Statuses tab  and click the Create Idea Status button to create a new idea status:

     

    Screen Shot 2015-02-10 at 9.35.07 AM.png

     

     

     

     

     

     

     

     

     

     

    (You could also add the status using the /board/message_statuses/available API call)

    After you've created the status for your idea exchange, you should be able to see that status in the results of the /board/message_statuses/available call.  In the results of that call, you should see an href property for the status you want to see -- it will look something like this:

     

    Screen Shot 2015-02-10 at 9.43.05 AM.png

     

    Take the URL for the message status you want from the href parameter and use that as the value of the message.status parameter -- something like this (the id will most likely be different for the status you want to set):

     

    /restapi/vc/messages/id/609/message_status/set?message.status=/message_statuses/id/5

    To be safe, you should probably URL encode your query parameter values, so you should probably do something like this instead:

     

    /restapi/vc/messages/id/609/message_status/set?message.status=%2Fmessage_statuses%2Fid%2F5

     

    I believe you can also use something like /message_statuses/key/<your status key> as well, so you could probably do this:

     

    /restapi/vc/messages/id/609/message_status/set?message.status=%2Fmessage_statuses%2Fkey%2Fduplicate

     

     

    Hopefully that does it.

     

    Thanks,

     

    -Doug

    • PerBonomi's avatar
      PerBonomi
      Boss

      Thanks OlivierS I've tried that and a lot of other possible combinations. I've been setting so many other values on different fields with no issue, but this one remains a mystery.

      I even got a success response using $.post("/restapi/vc/messages/id/609/message_status/?message.status=implemented") , but it didn't actually change any of the values.

       

      Any chance we could get an engineer to weigh in on this one?

      • DougS's avatar
        DougS
        Khoros Oracle

        Hi PerBonomi ,

         

        The reason that $.post("/restapi/vc/messages/id/609/message_status/?message.status=implemented") returned a success response is that V1 of Lithium's REST API lets you make calls that are meant to be made as GET requests as POST requests, so that was returning you the message_status of a message (you made /message/message_status call, which returns the message status).

         

        You need to make a call like this (using the /message/message_status/set call) to set the message status:

         

        /restapi/vc/messages/id/609/message_status/set?message.status=duplicate

         

        The key is to pass the status value as the value of the message.status query parameter.

         

        I hope that helps!

         

        -Doug

  • Akenefick nope. Still using my original workaround:

    Use API to change status, find the latest reply to the idea then use the api to edit that reply.

    One advantage to this approach is that I can now also add the date it was updated and link to itself, so when it shows up on the first page you can actually click the link to find it in the long list of replies. Because for some reason Khoros's system still doesn't do this.

    Example.