1. Home
  2. API
  3. Add assets to a marker

Add assets to a marker

As always, to authenticate a call Basic Authentication header should be set. See this TNO for details.

As soon as BEAR API is REST one (read here for details), to create an asset we have to use POST request to assets.

To create an assets you have to know ID of the marker this asset will be added to. See how to create a marker here. To get list of markers, you can call GET http://apidev.bear2b.com/markers?book_id=<campaign_id>

There are few types of assets can be created in BEAR:

ID name type Description
1 file media 3D object
2 email button e-mail
3 url button URL button
4 phone button Phone button
5 video media Video
6 image media Image
7 webview media Web-view
9 audio media Audio
10 vcard button vCard
11 facebook button Facebook
12 twitter button Twitter
13 share button Share
14 agenda button Agenda
15 file media File

Assets positioning is quite tricky and described in dedicated document here.

Code snippets:

We will work with marker #21187 of campaign #649

Create 3D object asset

Video(asset_type=5) and image(asset_type=6) created similarly. The only difference is another asset_type.

File-android used for 3D objects only.

Live example here

<form action="https://user:test@apidev.bear2b.com/assets" method="POST" enctype="multipart/form-data">
    <p>marker id:<input name="page_id" type="text" value="21187"/></p>
    <p>asset_type:<input name="asset_type" type="text" value="1"/></p>
    <p>file:<input name="file" type="file" /></p>
    <p>custom image:<input name="custom_image" type="file" /></p>
    <p>x:<input name="x" type="text" value="-0.365"/></p>
    <p>y:<input name="y" type="text" value="-0.5"/></p>
    <p>width:<input name="width" type="text" value="0.5"/></p>
    <p>height:<input name="height" type="text" value="0.5"/></p>
    <p><button type="submit">Submit</button></p>
</form>

Create Email asset

url (asset_type=3), phone(asset_type=4) and text(asset_type=8) created similarly. The only difference is another asset_type

Live example here

<form action="https://user:test@apidev.bear2b.com/assets" method="POST" enctype="multipart/form-data">
    <p>marker id:<input name="page_id" type="text" value="21187"/></p>
    <p>asset_type:<input name="asset_type" type="text" value="2"/></p>
    <p>email:<input name="s1" type="text" value="contact@amudo.com"/></p>
    <p>custom image:<input name="custom_image" type="file" /></p>
    <p>x:<input name="x" type="text" value="-0.365"/></p>
    <p>y:<input name="y" type="text" value="-0.5"/></p>
    <p>width:<input name="width" type="text" value="0.25"/></p>
    <p>height:<input name="height" type="text" value="0.1"/></p>
    <p><button type="submit">Submit</button></p>
</form>
Was this article helpful to you? Yes No 1

How can we help?