Forum Discussion

Kev_B's avatar
Kev_B
Advisor
2 months ago

Delete 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.