This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
connections-api [2012/05/07 17:32] jposeika [Issues to discuss] |
connections-api [2014/12/27 16:29] (current) jposeika [User functions] |
||
---|---|---|---|
Line 14: | Line 14: | ||
* How do we handle errors/conflicts of single-sign on, e.g., user logs on OPAC user account, but for some reason (incorrect identifier, inexistent user, etc.) does not get logged in Connections? | * How do we handle errors/conflicts of single-sign on, e.g., user logs on OPAC user account, but for some reason (incorrect identifier, inexistent user, etc.) does not get logged in Connections? | ||
* How do we ask users to write reviews on the items they check back in? E-mail them? | * How do we ask users to write reviews on the items they check back in? E-mail them? | ||
- | ===== User functions ===== | + | * How do we handle users that already are ChiliFresh users and will have registered with the particular e-mail addresses? |
+ | * How do we identify OPAC requests with user_key parameter? Can we set up specific OPAC IP(s)? | ||
+ | ======= User functions ======= | ||
* Register **[API/widget/lightbox]** | * Register **[API/widget/lightbox]** | ||
* Using single sign-on **[API]** | * Using single sign-on **[API]** | ||
Line 24: | Line 26: | ||
* Using Twitter and Facebook **[widget/lightbox]** | * Using Twitter and Facebook **[widget/lightbox]** | ||
* Sign-out **[API]** | * Sign-out **[API]** | ||
+ | |||
+ | ===== getUserProfile: get user profile information ===== | ||
+ | Get user profile information | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**getUserProfile** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |user_id|Integer (10)|If //session_id// empty| | ||
+ | |session_id|If //user_id// empty| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2900</response_code> | ||
+ | <response_description>User account</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 17:23:23</response_time> | ||
+ | <nickname>Administrator</nickname> | ||
+ | <location>Mesa, Arizona, United States</location> | ||
+ | <age>4</age> | ||
+ | <avatar_small_img>http://chilifresh.com/userpic/small/blank.png</avatar_small_img> | ||
+ | <avatar_large_img>http://chilifresh.com/userpic/large/blank.png</avatar_large_img> | ||
+ | <last_login>2014-12-27 12:02:07</last_login> | ||
+ | <current_read> | ||
+ | <isbn>24640175</isbn> | ||
+ | <title>Harry Potter and the goblet of fire</title> | ||
+ | <author>by J.K. Rowling.</author> | ||
+ | <cover>https://content.chilifresh.com/?size=SC&isbn=24640175</cover> | ||
+ | </current_read> | ||
+ | </response> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2900|User profile information provided| | ||
+ | |2901|Inexistent user or profile restrictions| | ||
+ | |61|User not logged in or not specified| | ||
+ | |||
* Get/edit user information **[API/widget/lightbox]** | * Get/edit user information **[API/widget/lightbox]** | ||
* Gender | * Gender | ||
Line 56: | Line 108: | ||
- | ===== Bookshelf functions ===== | + | ====== Bookshelf functions ====== |
+ | |||
+ | ===== bookshelfCreate: create new user bookshelf ===== | ||
+ | Creates a new user bookshelf | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfCreate** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelfname|Variable characters(50)|Yes| | ||
+ | |default|yes/no|No (default: no)| | ||
+ | |public|yes/no|No (default: no)| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2100</response_code> | ||
+ | <response_description>Bookshelf created successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 13:02:20</response_time> | ||
+ | <user_id>64</user_id> | ||
+ | <shelf_id>22773</shelf_id> | ||
+ | <shelf_name>APIshelf</shelf_name> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2100|Bookshelf created successfully| | ||
+ | |2101|Empty bookshelf name| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | |||
+ | ===== bookshelfDelete: delete an existing bookshelf of user ===== | ||
+ | Delete an existing bookshelf of user | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfDelete** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelf_id|Integer(10)|Yes| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>123</response_code> | ||
+ | <response_description>Shelf deleted successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 13:51:32</response_time> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2200|Shelf deleted successfully| | ||
+ | |2201|Cannot delete bookshelf| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | |||
+ | |||
+ | ===== bookshelfChangeSettings: change settings of bookshelf ===== | ||
+ | Changes settings of a bookshelf | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfChangeSettings** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelf_id|Integer (10)|Yes| | ||
+ | |default|yes/no|No| | ||
+ | |public|yes/no|No| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2300</response_code> | ||
+ | <response_description>Settings changed successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 15:30:23</response_time> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2300|Settings changed successfully| | ||
+ | |2301|Cannot change settings to bookshelf| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | |||
+ | ===== bookshelfAddItem: add an item to bookshelf ===== | ||
+ | Add an item - book, CD, DVD, etc. - to an existing bookshelf | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfAddItem** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelf_id|Integer (10)|Yes| | ||
+ | |item_id|ISBN, UPC, ISSN, etc.|Yes| | ||
+ | |cf_item_id|Integer (10) - item identifier from CF database|No| | ||
+ | |item_title|Variable characters (100) - item title|Only if adding unidentified item by //item_id//| | ||
+ | |item_author|Variable characters (100) - item author|Only if adding unidentified item by //item_id//| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2400</response_code> | ||
+ | <response_description>Item added to shelf successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 15:46:04</response_time> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2400|Item added to shelf successfully| | ||
+ | |2401|Cannot identify item| | ||
+ | |2402|Cannot add item to bookshelf| | ||
+ | |2403|Empty item identifier| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | |||
+ | ===== bookshelfRemoveItem: remove an item from an existing bookshelf ===== | ||
+ | Remove an item from an existing bookshelf | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfAddItem** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelf_id|Integer (10)|Yes| | ||
+ | |item_id|ISBN, UPC, ISSN, etc.|Yes| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2500</response_code> | ||
+ | <response_description>Item removed successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 15:46:04</response_time> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2500|Item removed successfully| | ||
+ | |2501|Cannot remove item from bookshelf| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | |||
+ | ===== bookshelfListShelves: listing all shelves of a user ===== | ||
+ | Listing all shelves of a user - whether logged in user, or not logged in | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfListShelves** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |user_id|Variable characters (32)|If //session_id// empty| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|If //user_id// empty| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2600</response_code> | ||
+ | <response_description>Shelves listed successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 16:07:49</response_time> | ||
+ | <user_id></user_id> | ||
+ | <bookshelves> | ||
+ | <bookshelf> | ||
+ | <id>22761</id> | ||
+ | <item_count>0</item_count> | ||
+ | <shelf_title>Test shelf</name> | ||
+ | <order>0</order> | ||
+ | <default>no</default> | ||
+ | <required>no</required> | ||
+ | <public>no</public> | ||
+ | <date>Sat, 27 Dec 2014 11:57:28</date> | ||
+ | </bookshelf> | ||
+ | </bookshelves> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2600|Shelves listed successfully| | ||
+ | |61|User not logged in or not specified| | ||
+ | |||
+ | |||
+ | ===== bookshelfListItems: list all items of some particular bookshelf ===== | ||
+ | List all items of some particular bookshelf | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfListItems** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |shelf_id|Integer (10)|Yes| | ||
+ | |user_Id|Integer (10)|If //session_id// empty| | ||
+ | |session_id|ChiliFresh session - retrieved from userRegister, userLogin or userCreateSession call|If //user_id// emtpy| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2700</response_code> | ||
+ | <response_description>Listing of bookshelf successful</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 17:05:21</response_time> | ||
+ | <user_id>231853</user_id> | ||
+ | <shelf_id>22762</shelf_id> | ||
+ | <shelf_title>APIshelf2</shelf_title> | ||
+ | <item_count>4</item_count> | ||
+ | <shelf_type>private</shelf_type> | ||
+ | <shelf_type_description>Own, full access</shelf_type_description> | ||
+ | <items> | ||
+ | <item> | ||
+ | <title>Motivated minds</title> | ||
+ | <author>Deborah Stipek and Kathy Seal.</author> | ||
+ | <isbn>0805063951</isbn> | ||
+ | <item_id>3</item_id> | ||
+ | <work_id>3</work_id> | ||
+ | <date>Sat, 27 Dec 2014 15:41:28</date> | ||
+ | </item> | ||
+ | </items> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2700|Listing of bookshelf successful| | ||
+ | |61|User not logged in or not specified| | ||
+ | |||
+ | ===== bookshelfMoveItem: move an item from one bookshelf to another ===== | ||
+ | Move an item from one bookshelf to another | ||
+ | |||
+ | ==== Input ==== | ||
+ | * URL for XML output: https://secure.chilifresh.com/api/connections/ | ||
+ | * URL for JSON output: https://secure.chilifresh.com/api/connections/json/ | ||
+ | * Method: POST | ||
+ | * Parameters: | ||
+ | |||
+ | |**Parameter** |**Type (size)** |**Mandatory** | | ||
+ | |action|**bookshelfMoveItem** |Yes| | ||
+ | |account|Integer (10)|Yes| | ||
+ | |from_shelf|Integer (10)|Yes| | ||
+ | |to_shelf|Integer (10)|Yes| | ||
+ | |item_id|Integer (10)|Yes| | ||
+ | |session_id|Yes| | ||
+ | |location|Variable characters (40)|If applicable| | ||
+ | |api_key|Variable characters (40)|Yes| | ||
+ | |||
+ | ==== Output ==== | ||
+ | |||
+ | |||
+ | **XML output example:** | ||
+ | <code> | ||
+ | <?xml version="1.0"?> | ||
+ | <response> | ||
+ | <response_code>2800</response_code> | ||
+ | <response_description>Item moved successfully</response_description> | ||
+ | <response_time>Sat, 27 Dec 2014 17:16:55</response_time> | ||
+ | </response> | ||
+ | </code> | ||
+ | |||
+ | ==== Response code ==== | ||
+ | |**Code** |**Code description** | | ||
+ | |2800|Item moved successfully| | ||
+ | |2801|Could not move item to other bookshelf| | ||
+ | |2802|Target shelf does not belong to session user| | ||
+ | |60|Session invalid, expired or empty| | ||
+ | ====== Account-related errors ====== | ||
+ | |**Error code** |**Error description** | | ||
+ | |0|System error| | ||
+ | |1|Invalid (empty) API key| | ||
+ | |2|Invalid API key| | ||
+ | |3|API key request limit reached| | ||
+ | |4|API key deactivated| | ||
+ | |5|Invalid API call| | ||
+ | |20|Empty account ID| | ||
+ | |30|Account does not exists| | ||
+ | |40|Account suspended| | ||
+ | |50|Action not specified| | ||
* Show user's bookshelf **[widget/lightbox]** - the widget can be displayed just as on Connections | * Show user's bookshelf **[widget/lightbox]** - the widget can be displayed just as on Connections | ||