Create a campaign


As always, to authenticate a call Basic Authentication header should be set. See Authentication for details. As soon as BEAR API is REST one (details), to create a campaign we have to use POST request to campaigns.

Only users with admin role can create a campaign.

Code (working example here):

var user = 'admin';
var password = 'test';
var auth = "Basic " + btoa(user + ":" + password);
var urlApi = '';
var params = {name:'test'};
    processData: true,
    type: 'POST',
    url: urlApi,
    headers: {"Authorization": auth},
    data: JSON.stringify(params),
    dataType: 'json',
    success: function(data){
        var campaign = data[0];
        $('body').html( + ' ' +;
    error: function(data){
        $('body').html( data.responseJSON.error + ' ' + data.responseJSON.description );

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.