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:
- Basket API
- How does it work?
- Add files to basket
- MethodInput Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Show basket
- Method
- Input Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Delete all files in basket
- Method
- Input Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Delete item in basket
- Method
- Input Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Download basket
- Method to initiate download
- Input Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Method to check for basket availability
- Input Parameter
- Output Value
- REST: Sample Request
- Sample Output
- Method to initiate download
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_id | Basket Id | String | yes | 7859437598-2345-2345 |
asset_id | Valid ID of an asset in Razuna | String | yes | 523908044-4355-4R5T-B67B-55TG767U875 |
asset_type | Original or thumbnail | String | no | defaults 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
/global/api2/basket.cfc?method=addToBasket&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&basket_id= 7859437598 - 2345 - 2345 &asset_id= 523908044 - 4355 -4R5T-B67B-55TG767U875
|
Sample Output
{[ "responsecode" : "0" , "message" : "File has been added to the basket" ]}
|
Output format
<span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span>
<div class="confluence-information-macro-body"><p>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".</p></div> </div>
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_id | Basket Id | String | yes | 7859437598-2345-2345 |
Output Value
Name |
Description |
Sample Output |
---|---|---|
asset_id |
The asset id |
108 |
asset_type | By default "org" (original) else "thumb" (thumbnail) | org |
REST: Sample Request
/global/api2/basket.cfc?method=showBasket&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&basket_id= 7859437598 - 2345 - 2345
|
Sample Output
{ "COLUMNS" :[ "asset_id" , "asset_type" ], "DATA" :[[ "F1E00574-2874-4B5E-A82BA6CC7D45856A" , "org" ]]}
|
Output format
<span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span>
<div class="confluence-information-macro-body"><p>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".</p></div> </div>
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_id | Basket ID | String | ywa | 7859437598-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
/global/api2/basket.cfc?method=deleteBasket&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&basket_id= 7859437598 - 2345 - 2345
|
Sample Output
{[ "responsecode" : "0" , "message" : "All files in your basket have been removed" ]}
|
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_id | Basket ID of the comment | String | yes | 7859437598-2345-2345 |
asset_id | Asset ID | String | yes | 108 |
asset_type | Type of asset | String | no | "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
/global/api2/basket.cfc?method=remove&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&basket_id= 7859437598 - 2345 - 2345 &asset_id= 108
|
Sample Output
{[ "responsecode" : "0" , "message" : "File have been removed from this basket" ]}
|
Download basket
Downloading basket
<span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span>
<div class="confluence-information-macro-body"><p>Please note, that downloading the basket has <strong>two</strong> parts!</p><p>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.<br><br>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.</p></div> </div>
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_id | Basket ID of the comment | String | yes | 7859437598-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
/global/api2/basket.cfc?method=downloadBasket&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&basket_id= 7859437598 - 2345 - 2345
|
Sample Output
{[ "responsecode" : "0" , "message" : "basket-89749837.zip" ]}
|
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_file | Name of ZIP file | String | yes | basket-89749837.zip |
Output Value
Name |
Description |
Sample Output |
---|---|---|
responsecode |
A response number |
0 = success |
message |
File availablity |
true = available |
REST: Sample Request
/global/api2/basket.cfc?method=checkForBasket&api_key= 54592180 - 7060 -4D4B-BC74-2566F4B2F943&zip_file=basket- 89749837 .zip
|
Sample Output
{[ "responsecode" : "0" , "message" : "true" ]}
|