ContributionsMost RecentMost LikesSolutionsDelete a bookmark subscription Hi, I'm working on a customisation within one of our TKBs where we want to make bookmark functionality more visible. I'm creating a button to bookmark and another to remove the bookmark. My bookmark button is working as intended, but I'm having difficulty removing/deleting the bookmark. $("#remove-bookmark").on( "click", function() { $.ajax({ type: "DELETE", url: "/api/2.0/users/${userID}/badges/${bookmarkID}", contentType: "application/json", dataType: "json", }).done(function(jqXHR, textStatus) { console.log('Success' + textStatus) }).fail(function(jqXHR, textStatus) { console.log('Fail: ' + textStatus); }); }); I'm using the URL /api/2.0/users/user-id/badges/subscription-id based on documentation. Am I right in substituting user-id and subscription-id for the respective values? In my specific test case, the URL being called is /api/2.0/users/67/badges/3829. Here's the server response: { "status": "error", "message": "An unexpected error occurred.", "data": { "type": "error_data", "code": 301, "developer_message": "", "more_info": "" }, "metadata": {} } Any help appreciated. Re: 400/404 error on POST request Thank you so much for this Claudius I ended up solving this particular problem a different way, but your code provided me the perfect template for another subscription button that was further down my to-do list. Appreciate your help and for explaining things so well. 400/404 error on POST request Hey, I'm trying to do my very first POST API call and currently getting stuck. I know there are other solutions for what I'm trying to do, but I'm also trying to learn something rather than straight up copying & pasting. <#assign boardID = coreNode.id /> <button id="subscribe">Subscribe</button> <@liaAddScript> (function($){ $(document).ready(function(){ $("#subscribe").on( "click", function() { $.ajax({ url: "/api/2.0/subscriptions", dataType: 'json', data: { "data":{ "type":"subscription", "target":{ "type":"board", "id":"blueprints" } } }, method: 'POST' }).done(function(response) { console.log('Success'); }).fail(function() { console.log('Fail'); }) }); }); })(LITHIUM.jQuery); </@liaAddScript> When I click my button on the page, I get a 404 error in the console: GET https://community-stage.blueprism.com/api/2.0/subscriptions?data%5Btype%5D=subscription&data%5Btarget%5D%5Btype%5D=board&data%5Btarget%5D%5Bid%5D=blueprints 404 (Not Found) I assume I'm doing something wrong, but I can't figure out what. I've tried subbing the variable for the ID of the board too and the URL is the same, with the same 404 error. The only thing that's sprung to mind is that the API's don't work with the CNAME and I need to use the original domain for our staging site? Thanks in advance. SolvedRe: 400/404 error on POST request I've made a few revisions - mostly stabs in the dark, but got rid of the 404 response. Now I'm getting 400 (Bad Request) in response from the API. Would really appreciate if anybody who's been through similar growing pains is able to share some wisdom. I don't understand why it's unhappy with the request. <#assign boardID = coreNode.id /> <button id="subscribe">Subscribe</button> <@liaAddScript> (function($){ $(document).ready(function(){ $("#subscribe").on( "click", function() { $.ajax({ type: 'post', url: "/api/2.0/subscriptions", dataType: 'json', data: JSON.stringify({ "type":"subscription", "target":{ "type":"board", "id":"${boardID}" } }) }).done(function(response) { console.log('Success'); }).fail(function(response) { console.log('Fail'); }) }); }); })(LITHIUM.jQuery); </@liaAddScript> Re: Caching node variant - inconsistent results Thanks for the tips Calvin2971 Strange thing happened - so I realised an error with my creation of the menus (I was using custom_tags so had to update my REST call). I found that after doing this, the menus were loading on the redirected pages as expected. I have no idea why REST Admin made it work, but that seemed to be what did it. Caching node variant - inconsistent results Hi, We have a category on our community that contains 5 child TKBs. I've built a menu so that on the category page, it shows the 5 TKBs, clicking on the first one will take you to the first article in that TKB (via a redirect). Once in the TKB, the menu will display all of the articles for that specific TKB. The problem I have, when using liaMarkupCache and "node" variation, the sub-menu doesn't populate on that first page of the TKB. It's like it's caching the result from the category page, despite different coreNode.id's for each. I assume the redirect is messing with things somehow, but not sure how? The TKB page shows the same coreNode.id as its children, so I assume the "node" variation would still work. Any help appreciated. Re: Customise a closed Group Hub page Thanks Akenefick - I assumed there must've been a different page in play but wasn't sure how to find it. I've got that page in Studio now so can do what I need to do, thank you. Thanks as well for the handy tidbit on finding this out in future as well 😀 Customise a closed Group Hub page Hi, I want to customise some Group Hub pages so the same page hosts information/content to non-members, as well as acting as the group hub home for members. e.g. for a product research program, we have a sign-up survey on a page with a whole load of other info designed to promote the program. I've managed to do this with coreNode.id, but it only works for an 'Open' type group hub, and my use case requires it to work on 'Closed' or 'Hidden' group hubs. Code below is just from a quick proof of concept test. <#if coreNode.id??> <#assign node = coreNode.id /> <p>Node: ${node}</p> <#assign query = "SELECT user_context.is_member FROM grouphubs WHERE id = '" + node + "'" /> <#assign x= rest("2.0","/search?q=" + query?url) /> <#if x.data?size gt 0> <#list x.data.items as item> <#if item.user_context.is_member> <p>You're a member</p> <#else> <p>You're not a member</p> </#if> </#list> </#if> </#if> I've tried a couple of other context objects, but the code in my component doesn't seem to display at all on the page if it's closed or hidden. Does anybody have experience of customising group hubs in this way? TIA SolvedSend data to third-party API when posting/updating post Hi, I'm exploring automating the Ideas front-end of our community with the different system our product teams use on the back-end. The first issue I'm attempting to solve - creating an API call when a new idea is posted, or an idea is updated on the community. I think this should flow something like follows: Get the ID when a message is posted/updated (assume I need a POST request) This triggers an endpoint to pull out the message data via GET request and pass relevant information to the third-party API Third-party API receives relevant data and their information is updated I have two sticking points I'm trying to answer currently: What's the best way to trigger something from the post page? Is an additional click event on the 'Submit' button acceptable practice? How do I then get the ID so I can use it in a GET request to get relevant data? (Alternatively - is it better to just grab that data - subject, message body, etc, from the post page?) Appreciate any input or suggestions. I'm quite new to POST requests, I think I understand the basics, but I can't find anything in developer docs that breaks down the steps I'm trying to take. Thanks, Re: Khoros Roadmap Webinar Thanks RachelC 😃