Create a marker


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

To create a marker you have to know ID of the campaign this marker will be added to. See how to create a campaign here. To get list of campaigns, you can call GET

There are 2 ways to provide actual image file to be used as marker - over a URL or by selecting a file from the local drive.

Create a marker from an URL

Code (working example here):

var user = 'user';
var password = 'test';
var auth = "Basic " + btoa(user + ":" + password);
var urlApi = '';
// Users allowed to add markers to their own campaigns or to campaigns of their company
var campaignId = 649; // user's campaign (Your First Campaign)
// Note: you can get list of your campaings by calling GET
var params = {
    processData: true,
    type: 'POST',
    url: urlApi,
    headers: {"Authorization": auth},
    data: JSON.stringify(params),
    dataType: 'json',
    success: function(data){
        var marker = data[0];
        $('body').html('#' + ' ' + marker.page_num);
    error: function(data){
        $('body').html( 'Marker has been created!' );
        $('body').html( data.responseJSON.error + ' ' + data.responseJSON.description );

Send markers as a file

Live example here

campaign id:



Cet article vous a-t-il été utile ?
Utilisateurs qui ont trouvé cela utile : 0 sur 0


0 commentaire

Vous devez vous connecter pour laisser un commentaire.