Forum Discussion

Han's avatar
Han
Ace
7 years ago

Retrieve custom tags from post

Hi All,

I would like to be able to access the custom tags for a forum message by message id. 

I have been trying to access with the meta api call, but not sure how to get the correct key to retrieve the information. 


https://lithosphere.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv1&leaf-id=Message.metadata#Message.metadata.key.key

My current api call is 

restadmin("/messages/id/${page.context.message.id}/metadata/key/modbar")


However, I am unsure of what needs to be on the end of modbar. Does anyone have any idea?

  • Hanand ShaneP1

    You can use below API to fetch list of all metadata keys of custom tags from a message. Change message id "1271" with your respective post messages id in code.

    http://community.lithium.com/community-name/restapi/vc/messages/id/1271/metadata/entries

    After getting all the keys you can pass this to API V1 or V2 to get all the information regarding message or custom tags

  • Hanand ShaneP1

    You can use below API to fetch list of all metadata keys of custom tags from a message. Change message id "1271" with your respective post messages id in code.

    http://community.lithium.com/community-name/restapi/vc/messages/id/1271/metadata/entries

    After getting all the keys you can pass this to API V1 or V2 to get all the information regarding message or custom tags

  • Han

    For V1 you need to call below API to fetch cutom tag from the message, this will returns value for key "modbar.claim":

     

    https://community.lithium.com/restapi/vc/messages/id/4140/metadata/key/modbar.claim

     

    You can use also use V2 to get custom tag key value using below query:

     

    SELECT id FROM messages WHERE custom_tags.text = 'customTagKey'

     

    For more information you can also view this article for how to get cutomTag key name and path for edit tags.

    https://lithosphere.lithium.com/t5/Custom-tags/Using-the-Community-API-with-Custom-Tags/ta-p/39908

     

     

     

    • Han's avatar
      Han
      Ace

      Thanks Parshant. I was hoping to be able to get a whole list of custom tags applied to a post, without knowing what they are. 

      Reading the article it seems you need the key before you can query custom tags. 

  • Thanks for this thread i needed this badly as i was in the middle of doing this then i realized that it doesnt work like this. I was gonna create a thread but bumped into this one Thanks.