Forum Discussion

akashm's avatar
akashm
Mentor
3 years ago

Is there way to create new status for ideas via API?

Hi,

 

I am trying to update the idea statuses of the Idea Boards for my community via API REST Call.

 

There are about 11 idea exchange boards, and 7 custom idea statuses per board, so it is pretty tedious to update the idea statuses per board manually through the UI.

 

Is there a way to perform this operation via API instead?

I found this: https://devdocportal.khoros.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&leaf-id=Board.message_statuses#Board.message_statuses.available.add 

But, I can't get this to work with the query params either.

 

Any help is appreciated

 

/Akash

8 Replies

  • akashm's avatar
    akashm
    Mentor
    3 years ago

    I think that's where I am faltering as well.

    The variable the document above accepts is called MessageStatus but I have no idea how to add that in the query parameter

  • AdamN's avatar
    AdamN
    Khoros Oracle
    3 years ago

    akashm It is expecting the id or the key of the status, as defined when you created the status. Then you pass it in the request like:

    .../message_statuses/available/add?message.status=key/accepted

    or

    .../message_statuses/available/add?message.status=id/654

    (Note, you'll want to URL-encode your query param values. I'm leaving them unencoded here for readability)

    If you need to create new statuses, you can use:

    https://devdocportal.khoros.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&leaf-id=Community.message_statuses#Community.message_statuses.add

    I hope this helps!

  • AdamN Since we’re on the topic - Do you know if we can see the featured idea statuses via API somehow? We’re getting ready to launch our IE, and our engineer couldn’t figure that out (We made a new status component but had to hardcode which ones showed up). 

    edit: Ignore me, I should have read all the link you sent first 😂. I think it’s on there!!

    edit 2:  Actually question stands as I think this only covers creating a new idea, can we query it the same way to see if it’s featured?

  • AdamN's avatar
    AdamN
    Khoros Oracle
    3 years ago

    Hi StanGromer , I'm not seeing a separate call for editing/updating in our docs. However, from a cursory look at the logic behind the scenes, it appears that if you specify an existing key via the /add method, it will attempt to update the corresponding status. This seems to be implied by the documentation as well since it mentions for the "returns" details:

     

    MessageStatus: either the pre-existing message status with the provided key and type (if provided), or the newly created status.

     

    But you may want to try it in stage first, just to make sure it works as expected.

    I hope this helps!

  • akashm's avatar
    akashm
    Mentor
    3 years ago

    Thanks for your help AdamN , can you tell me where I am going wrong?

     

    here's my example request based on your suggestion

    https:<My URL>/vc/boards/id/<Board ID>/message_statuses/add?message_status.key=pending_closure&message_status.name=Pending Closure&message_status.description=<Some random description>&message_status.type=idea

    Note that I am following https://devdocportal.khoros.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&leaf-id=Board.message_statuses#Board.message_statuses.available.add and I am adding the Board ID to the param as well

     

    But I am getting the following error:

    <response status="error">
        <error code="501">
            <message>
          Unknown path element at node &apos;board_message_status_context&apos;.
        </message>
        </error>
    </response>

     I don't even know what a board_message_status_context is 😁

  • Hi akashm,

     

    Can you please try this one?

     

    [COMMUNITY_URL]/restapi/vc/boards/id/[BOARD_ID]/message_statuses/available/add?message.status=key/pending_closure

     

    Thanks!

  • akashm's avatar
    akashm
    Mentor
    3 years ago

    Thanks Payal didn't really work.

     

    Request: 

    https://<MY URL>/restapi/vc/boards/id/<My Board ID>/message_statuses/add?message_status=key/pending_closure

     

    Response: 

    <response status="error">
        <error code="501">
            <message>
          Unknown path element at node &apos;board_message_status_context&apos;.
        </message>
        </error>
    </response>
  • AdamN's avatar
    AdamN
    Khoros Oracle
    3 years ago

    akashm It looks like you're missing the /available path in the request. 

    At community level, when creating the status, the path is:

    /restapi/vc/message_statuses/add

    At the board level, when associating the already created status with the board, the path is:

    /restapi/vc/boards/id/<board id>/message_statuses/available/add

    So for your last example, it would be something like:

    https://<MY URL>/restapi/vc/boards/id/<My Board ID>/message_statuses/available/add?message_status=key/pending_closure

    Please give this a try instead