khill
Joined 10 years ago
Joined 10 years ago
Unfortunately, there's no such field value API in V1 and V2 to accomplish this when message is delete.
However, it may be feasible to use Event Subscription REST API and some custom development to achieve this. This application notifies its subscribers so that some action can take place , asynchronously, as a result..
It support and gives Events Like: MessageDelete, MessageUpdate etc.
http://community.mycommunity.com/restapi/vc/events/subscriptions/events/name/MessageDelete/subscribe?event.callback_url=http://watchdog.mycompany.com/indexContent
You need to run above subscription API in your community, after that you will receive a notification any time a message has been deleted, across the entire community.
Subscription to community last until you explicitly unsubscribe.
You can see more information here in this url.
Hi khill,
You are not missing anything. There is currently (here's hoping) no way to directly grab the custom_tags data except with the APIV2 query of :
SELECT * FROM custom_tags WHERE messages.id='<insert message.id here>'
If you want to grab the data and add it to your queries results, you can do something like this:
<#assign mergedResults = [] >
<#assign apiQuery = "SELECT id, custom_tags FROM messages WHERE post_time > [yesterday]" >
<#assign apiResults = rest("2.0", "/search?q="+apiQuery?url) >
<#if apiResults.data.items?? >
<#list apiResults.data.items as message >
<#assign apiQuery2 = message.custom_tags.query >
<#assign apiResults = rest("2.0", "/search?q="+apiQuery2?url) >
<#if apiResults2.data.items?? >
<#assign mergedResults += [message+{"custom_tags":apiResults2.data.items}] >
</#if>
</#list>
</#if>
Sources:
APIV2 - Custom Tags
Parshant is right, would you like your email to be accessible like that trough a public community URL =)?
You have two options (maybe more, but that's off the top of my head)
a) Do the OAuth flow with the public v2 API URL (the one you're using now)
or
b) Write a custom component that does the same thing, but uses restadmin() instead, like this even if the current user does not have the right permissions, the personal data will be fetched, that also means you should be careful using restadmin() as it can expose information that you might not want to, so limit your query fields etc., that might look something like this:
<#assign query = "SELECT login, email FROM users ORDER BY registration_data.registration_time DESC"?url />
<#assign response = restadmin("2.0", "/search?q=" + query) />
<#if response.data.items?has_content>
<ol class="userlist">
<#list response.data.items as user>
<li class="user">
<span class="user__login">${user.login}</span>
<span class="user__email">${user.email}</span>
</li>
</#list>
</ol>
</#if>this is untested code, so use at your own risk =)