Skip to end of metadata
Go to start of metadata

Availability

The basket API is available in Razuna 1.7.1 and later.

Basket API

The basket API allows a developer to use Razuna for storing files in a temporary location on the Razuna server. This gives you the power of a shopping cart like feature. The following methods are available:

How does it work?

In order to store files in the basket, you need to generate a "basket_id" in your system. This can be any kind of number, string, etc. Simply make sure you give each user of your website a unique number. Then simply pass this basket_id to every request on your site (so users can browse your site without loosing their basket). With this basket_id you also query the basket API. You also need to have an API KEY to use this API.

Add files to basket

Adds any kind of file to the basket.

Method

Method Name

Returns

addToBasket

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

basket_idBasket IdStringyes7859437598-2345-2345
asset_idValid ID of an asset in RazunaStringyes523908044-4355-4R5T-B67B-55TG767U875
asset_typeOriginal or thumbnailStringnodefaults to original file. If you want to add the thumbnail to a basket use "thumb"
Only applies to images!

Output Value

Name

Description

Sample Output

responsecode

A response number

0 = success

message

Status of operation

File has been added to the basket

REST: Sample Request

Sample Output

Output format

Remember you can adjust the output dynamically. The API returns JSON by default. For record sets it defaults to a ROW based set, if you need COLUMNS simply append "&__BDQUERYFORMAT=column" to your call. In case, you need JSONP you want to append "&__BDRETURNFORMAT=jsonp&callback=?". In order to retrieve XML (WDDX) you simply need to append "&__BDRETURNFORMAT=wddx".

Show basket

Method

Method Name

Returns

showBasket

Record set

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

basket_idBasket IdStringyes7859437598-2345-2345

Output Value

Name

Description

Sample Output

asset_id

The asset id

108

asset_typeBy default "org" (original) else "thumb" (thumbnail)org

REST: Sample Request

Sample Output

Output format

Remember you can adjust the output dynamically. The API returns JSON by default. For record sets it defaults to a ROW based set, if you need COLUMNS simply append "&__BDQUERYFORMAT=column" to your call. In case, you need JSONP you want to append "&__BDRETURNFORMAT=jsonp&callback=?". In order to retrieve XML (WDDX) you simply need to append "&__BDRETURNFORMAT=wddx".

Delete all files in basket

Method

Method Name

Returns

deleteBasket

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

basket_idBasket IDStringywa7859437598-2345-2345

Output Value

Name

Description

Sample Output

responsecode

A response number

0 = success

message

Status of operation

All files in your basket have been removed

REST: Sample Request

Sample Output

Delete item in basket

Method

Method Name

Returns

deleteItemInBasket

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

basket_idBasket ID of the commentStringyes7859437598-2345-2345
asset_idAsset IDStringyes108
asset_typeType of assetStringno"org" (default)
"thumb" for thumbnail (only applies to images)

Output Value

Name

Description

Sample Output

responsecode

A response number

0 = success

message

Status of operation

File have been removed from this basket

REST: Sample Request

Sample Output

Download basket

Downloading basket

Please note, that downloading the basket has two parts!

One is the method downloadBasket(). This method initiates the collection of all files in the basket and then creates a ZIP file for downloading. The returning value (the ZIP file) of downloadBasket() can then be used in the *second" method, checkForBasket(), to check if the file is ready to download. Files are made available in a special directory called /tmp on your server. The full URL to the basket file depends on your installation but usually it is something like, e.g. (domain)/global/tmp/ZIPFILE or (domain)/razuna/global/tmp/ZIPFILE.

These methods will help you to create your own feedback to the client. This can either be a loading bar, a message or send them an email after the basket is ready.

Method to initiate download

Method Name

Returns

downloadBasket

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

basket_idBasket ID of the commentStringyes7859437598-2345-2345

Output Value

Name

Description

Sample Output

responsecode

A response number

0 = success

message

Name of ZIP file

basket-89749837.zip

REST: Sample Request

Sample Output

Method to check for basket availability

Method Name

Returns

checkForBasket

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

zip_fileName of ZIP fileStringyesbasket-89749837.zip

Output Value

Name

Description

Sample Output

responsecode

A response number

0 = success

message

File availablity

true = available
false = unavailable

REST: Sample Request

Sample Output

  • No labels