Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

ImportAPI

Stephan Zavrel

General Information

To use the Import API, the Security Token (e.g. b08f41cfa92b430538146cf474116c6d), which is generated as soon you sign in, has to be used in every Import API call. You can copy the Token form the section on the left under the API key or you can retrieve the Token from

[webapp path]/operator/signin?operatorId=USER&password=PASSWORD

which returns an xml like


<?xml version="1.0" encoding="ISO-8859-1"?>
<easyrec>
<action>signin</action>
<success code="105" message="User is signed in!"/>
<token>b08f41cfa92b430538146cf474116c6d</token>
</easyrec>

The token is invalidated when you sign out or as soon another user with the same credentials signs in. Note: During an import, make sure no one else signs in under your account, otherwise you will have to update the security token.

import rule

This call imports a rule.

A rule is relation between two items. (e.g. item A was viewed together with item B, where 'viewed together' is the assocation type, item A the 'from'-item and item B the 'to'-item). The strength of a relation is set through the association value, which starts from >0.0 (weak relation) to 100 (strongest relation). A set of rules having the same 'from'-item A are called recommendations of item A.

Rules are automatically computed by the ruleminer on a daily basis as soon significant user patterns are identified. In case you want to import your own rules you may query the Import API with the provided security token.

Sample call

HTTP GET

{yourServerURL}/api/1.1/importrule?token=b08f41cfa92b430538146cf474116c6d&tenantid=EASYREC_DEMO&itemfromid=42&itemfromtype=ITEM&itemtoid=42&itemtotype=ITEM&assoctype=VIEWED_TOGETHER&assocvalue=95.443

Parameters

parameter occurrence description
token required The required security token ("b08f41cfa92b430538146cf474116c6d") to access this service. This token is only valid for the current session.Note: The token invalidates, if you sign out.
tenantid required tenant id to identify your Website. (e.g. "EASYREC_DEMO")
itemfromid required A required base item id for the relation (e.g. "ID001")
itemtoid required A required partner item id for the relation (e.g. "ID003")
assocvalue required A required association value (0-100) to describe the relation strength between the two items. (e.g. "95.443"). Note:If you want to "delete" an imported rule, simply pass 0.0 as assoc value and the rule will not be shown in any recommendation, as long the ruleminer did not compute the same rule. If the same rule was computed or imported by different sources the average assoc value is taken. For example: the ruleminer computed a rule between item A and B with an association value of 50. Then a rule for the same two items with an asooc value of 100 is manually imported. The final association strength between the two items will be 75.
assoctype required A required association type. This parameter may be set to one of the following predefined values: VIEWED_TOGETHER, BOUGHT_TOGETHER, GOOD_RATED_TOGETHER, IS_RELATED. You can add more arbitrary accoy types using the Admin GUI.
itemfromtype optional; default:ITEM item type that denotes the type of the base item (e.g. IMAGE, VIDEO, BOOK, etc.). If not supplied the default value ITEM will be used.
itemtotype optional; default:ITEM item type that denotes the type of the partner item (e.g. IMAGE, VIDEO, BOOK, etc.). If not supplied the default value ITEM will be used.

Response

Error Codes

import/update item

This call imports or updates an item.

Sample call

HTTP GET

{yourServerURL}/api/1.1/importitem?token=b08f41cfa92b430538146cf474116c6d&tenantid=EASYREC_DEMO&itemid=42&itemdescription=Fatboy%20Slim%20-%20The%20Rockafeller%20Skank&itemurl=/item/fatboyslim&itemimageurl=/img/covers/fatboyslim.jpg&itemtype=ITEM

Parameters

parameter occurence description
token required The required security token ("b08f41cfa92b430538146cf474116c6d") to access this service. This token is only valid for the current session.Note: The token invalidates, if you sign out.
tenantid required tenant id to identify your Website. (e.g. "EASYREC_DEMO")
itemid required id to identify an item on your Website. (e.g. "ID001")
itemdescription required item description that is displayed when showing recommendations on your Website. (e.g. "the frog")
itemurl required url that links to the item page on your Website.
Note:Please encode &'s in url with %26
userid optional An optional anonymised id of a user. (e.g. "24EH1723322222A3")
itemimageurl optional An optional item image url that links to a image of the item.
Note:Please encode timestamp of the action. The parameter has the format "dd_MM_yyyy_HH_mm_ss" (e.g."01_01_2009_23_59_59").
itemtype optional; default:ITEM An optional item type that denotes the type of the item (e.g. IMAGE, VIDEO, BOOK, etc.).
If not supplied the default value ITEM will be used.

Response

Error Codes

set item active

This call sets an item active or inactive.

Sample call

HTTP GET

{yourServerURL}/api/1.1/setitemactive?token=8ab9dc3ffcdac576d0f298043a60517a&tenantid=EASYREC_DEMO&itemid=42&active=true&itemtype=ITEM

Parameters

parameter occurrence description
token required The required security token ("b08f41cfa92b430538146cf474116c6d") to access this service. This token is only valid for the current session.Note: The token invalidates, if you sign out.
tenantid required tenant id to identify your website. (e.g. "EASYREC_DEMO")
itemid required The id of the item you want to activate or deactivate
active required This value is used to activate or deactivate an item - set it to true(active)or false(deactivate)
itemtype optional; default:ITEM item type that denotes the type of the partner item (e.g. IMAGE, VIDEO, BOOK, etc.). If not supplied the default value ITEM will be used.

item types

If you want to load all item types of your tenant you can use the following API call

Sample Call

HTTP GET

{yourServerURL}/api/1.0/itemtypes?apikey=8ab9dc3ffcdac576d0f298043a60517a&tenantid=EASYREC_DEMO

Parameters

parameter occurrence description
apikey required The required API Key to access this service. (e.g. "8ab9dc3ffcdac576d0f298043a60517a")
tenantid required tenant id to identify your website. (e.g. "EASYREC_DEMO")

Response

Error Codes

add itemtype

You can add an item type to your tenant using the following API call

Sample Call

HTTP GET

{yourServerURL}/api/1.1/additemtype?apikey=8ab9dc3ffcdac576d0f298043a60517a&tenantid=EASYREC_DEMO

Parameters

parameter occurrence description
apikey required The required API Key to access this service. (e.g. "8ab9dc3ffcdac576d0f298043a60517a")
tenantid required tenant id to identify your website. (e.g. "EASYREC_DEMO")

Response

Error Codes

delete itemtype

You can delete an item type from your tenant using the following API call.
Be aware that deleting an item type will also deltee all actions, rules and items with the given itemtype!

Sample Call

HTTP GET

{yourServerURL}/api/1.1/additemtype?apikey=8ab9dc3ffcdac576d0f298043a60517a&tenantid=EASYREC_DEMO

Parameters

parameter occurrence description
apikey required The required API Key to access this service. (e.g. "8ab9dc3ffcdac576d0f298043a60517a")
tenantid required tenant id to identify your website. (e.g. "EASYREC_DEMO")

Response

Error Codes


Related

Wiki: API