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.