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 'message_status.key'.
Has anyone successfully done this?
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:
(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:
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