Follow

Add assets to a marker

As seen before, Basic Authentication header should be set to authenticate every call to the API. Please read this article for more details.

BEAR API being a REST one (look here for more details), we will have to use a POST request to create assets.

In order to create an asset you must first know the ID of the marker which the asset will be added to. Learn how to create a new marker here. To get a list of existing markers, you can call GET http://apidev.bear2b.com/markers?book_id=<campaign_id>

 

There are several types of assets that 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

8

text

button

Text

Following examples are written in JavaScript with jQueryWe will work with marker #21187 of campaign #649. 

Creating a 3D object asset

Note: video(asset_type=5) and image(asset_type=6) created similarly. The only difference is another asset_type.
Note: file-android used for 3D objects only.

<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>file-android:<input name="file-android" 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>

 

Creating an e-mail asset

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

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

 

Asset positioning is quite tricky and described in dedicated article here. 

0 Comments

Please sign in to leave a comment.