This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
keysapi [2011/08/05 19:21] jposeika created |
keysapi [2012/04/22 04:54] (current) |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Using Keys API you can generate and manipulate ChiliFresh Reviews API keys. It has output available in XML and JSON. | Using Keys API you can generate and manipulate ChiliFresh Reviews API keys. It has output available in XML and JSON. | ||
| - | ===== Covers availability data ===== | + | ===== generateKey call ===== |
| ==== Input ==== | ==== Input ==== | ||
| - | * URL for XML output: http://content.chilifresh.com/api/ | + | * URL for XML output: https://secure.chilifresh.com/api/generatekey/ |
| - | * URL for JSON output: http://content.chilifresh.com/api/json/ | + | * URL for JSON output: https://secure.chilifresh.com/api/generatekey/json/ |
| * Method: GET | * Method: GET | ||
| - | * Available both over plain HTTP and SSL | ||
| ==== Parameters ==== | ==== Parameters ==== | ||
| |**Parameter**|**Type (size)**|**Mandatory**|**Description**| | |**Parameter**|**Type (size)**|**Mandatory**|**Description**| | ||
| - | |isbn|Variable characters (20)|Yes|Item's ISBN, UPC or other ID| | + | |account|Integer (10)|Yes|ChiliFresh library account ID| |
| - | |size|Variable characters (50)|No|Options: //S// - small, //M// - medium, //L// - large, //empty// - returns all values. If incorrect size parameter, it is treated as empty.| | + | |
| Line 21: | Line 19: | ||
| |**Block** |**Element** |**Type (size)**|**Exists** |**Description** | | |**Block** |**Element** |**Type (size)**|**Exists** |**Description** | | ||
| |**Block //response// starts**|||Always| | | |**Block //response// starts**|||Always| | | ||
| - | |response|response_code|Integer (1)|Always|Response code 1 - response OK, 0 - missing item ID| | + | |response|response_code|Integer (1)|Always|See reference below| |
| |response|response_description|Text (255)|Always|Brief description of response code| | |response|response_description|Text (255)|Always|Brief description of response code| | ||
| |response|response_time|Date&time (D, d M Y H:i:s -hhmm)|Always|Example: Thu, 30 Jun 2010 07:25:58 -0500| | |response|response_time|Date&time (D, d M Y H:i:s -hhmm)|Always|Example: Thu, 30 Jun 2010 07:25:58 -0500| | ||
| - | |response|item_id|ISBN, UPC or other item ID |If //isbn// parameter present |ISBN, UPC or other item ID | | + | |response|api_key |Varchar(32) |If successful request |Reviews API key | |
| - | |response|small_cover_exists|1 or 0 |If //size// parameter is "S" or empty|1 if small cover exists, 0 if not| | + | |
| - | |response|small_cover_url|URL |If //small_cover_exists// is 1, this parameter includes displays cover URL|If //small_cover_exists// is 1, this parameter includes displays cover URL| | + | |
| - | |response|medium_cover_exists|1 or 0 |If //size// parameter is "M" or empty |1 if medium cover exists, 0 if not | | + | |
| - | |response|medium_cover_url|URL |If //medium_cover_exists// is 1, this parameter includes displays cover URL|If //medium_cover_exists// is 1, this parameter includes displays cover URL| | + | |
| - | |response|large_cover_exists|1 or 0 |If //size// parameter is "L" or empty|1 if large cover exists, 0 if not | | + | |
| - | |response|large_cover_url |URL |If //large_cover_exists// is 1, this parameter includes displays cover URL |If //large_cover_exists// is 1, this parameter includes displays cover URL | | + | |
| |**Block //response// ends**| | | | | | |**Block //response// ends**| | | | | | ||
| **XML input example:** | **XML input example:** | ||
| <code> | <code> | ||
| - | http://content.chilifresh.com/api/?isbn=9780578033440&size=L | + | https://secure.chilifresh.com/api/generatekey/?account=1234&action=generateKey |
| </code> | </code> | ||
| Line 41: | Line 33: | ||
| <code> | <code> | ||
| <response> | <response> | ||
| - | <response_code>1</response_code> | + | <response_code>100</response_code> |
| - | <response_description>Response OK</response_description> | + | <response_description>API key generated</response_description> |
| - | <response_time>Thu, 30 Jun 2011 07:25:58 -0500</response_time> | + | <response_time>Fri, 05 Aug 2011 20:26:12</response_time> |
| - | <item_id>9780578033440</item_id> | + | <api_key>492450b3d1a94c136887cef5c317713f</api_key> |
| - | <small_cover_exists>1</small_cover_exists> | + | |
| - | <small_cover_url>http://content.chilifresh.com/?isbn=9780578033440&size=S</small_cover_url> | + | |
| - | <medium_cover_exists>1</medium_cover_exists> | + | |
| - | <medium_cover_url>http://content.chilifresh.com/?isbn=9780578033440&size=M</medium_cover_url> | + | |
| - | <large_cover_exists>1</large_cover_exists> | + | |
| - | <large_cover_url>http://content.chilifresh.com/?isbn=9780578033440&size=L</large_cover_url> | + | |
| </response> | </response> | ||
| </code> | </code> | ||
| Line 57: | Line 43: | ||
| **JSON input example:** | **JSON input example:** | ||
| <code> | <code> | ||
| - | http://content.chilifresh.com/api/json/?isbn=9780578033440&size=L | + | https://secure.chilifresh.com/api/generatekey/json/?account=1234&action=generateKey |
| </code> | </code> | ||
| Line 63: | Line 49: | ||
| <code> | <code> | ||
| {"response": | {"response": | ||
| - | { | + | {"response_code":"100", |
| - | "response_code":"1", | + | "response_description":"API key generated", |
| - | "response_description":"Response OK", | + | "response_time":"Fri, 05 Aug 2011 20:29:41", |
| - | "response_time":"Thu, 30 Jun 2011 08:05:30 -0500", | + | "api_key":"80db3274f63128835425145be21311c4"} |
| - | "item_id":"9780578033440","small_cover_exists":"1", | + | |
| - | "small_cover_url":"http:\/\/content.chilifresh.com\/?isbn=9780578033440&size=S", | + | |
| - | "medium_cover_exists":"1", | + | |
| - | "medium_cover_url":"http:\/\/content.chilifresh.com\/?isbn=9780578033440&size=M", | + | |
| - | "large_cover_exists":"1", | + | |
| - | "large_cover_url":"http:\/\/content.chilifresh.com\/?isbn=9780578033440&size=L" | + | |
| - | } | + | |
| } | } | ||
| </code> | </code> | ||
| + | |||
| + | ==== Response codes ==== | ||
| + | |**Response code** |**Response description** | | ||
| + | |100|API key generated| | ||
| + | |101|API key generating error| | ||
| + | |||
| + | |||
| + | ===== destroyKey call ===== | ||
| + | ==== Input ==== | ||
| + | * URL for XML output: https://secure.chilifresh.com/api/generatekey/ | ||
| + | * URL for JSON output: https://secure.chilifresh.com/api/generatekey/json/ | ||
| + | * Method: GET | ||
| + | ==== Parameters ==== | ||
| + | |**Parameter**|**Type (size)**|**Mandatory**|**Description**| | ||
| + | |account|Integer (10)|Yes|ChiliFresh library account ID| | ||
| + | |api_key|Varchar (32)|Yes|Valid API key| | ||
| + | ==== Output ==== | ||
| + | * Format: XML, JSON | ||
| + | * Blocks and elements: | ||
| + | |||
| + | |**Block** |**Element** |**Type (size)**|**Exists** |**Description** | | ||
| + | |**Block //response// starts**|||Always| | | ||
| + | |response|response_code|Integer (1)|Always|See reference below| | ||
| + | |response|response_description|Text (255)|Always|Brief description of response code| | ||
| + | |response|response_time|Date&time (D, d M Y H:i:s -hhmm)|Always|Example: Thu, 30 Jun 2010 07:25:58 -0500| | ||
| + | |response|api_key |Varchar(32) |If successful request |Reviews API key | | ||
| + | |**Block //response// ends**| | | | | | ||
| + | |||
| + | **XML input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/?account=1234&action=destroyKey&api_key=90a8s0d98a09s8d90a8s0d8 | ||
| + | </code> | ||
| + | |||
| + | **XML output example:** | ||
| + | <code> | ||
| + | <response> | ||
| + | <response_code>200</response_code> | ||
| + | <response_description>API key destroyed</response_description> | ||
| + | <response_time>Fri, 05 Aug 2011 20:26:12</response_time> | ||
| + | <api_key>492450b3d1a94c136887cef5c317713f</api_key> | ||
| + | </response> | ||
| + | </code> | ||
| + | ---- | ||
| + | |||
| + | **JSON input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/json/?account=1234&action=destroyKey&api_key=90a8s0d98a09s8d90a8s0d8 | ||
| + | </code> | ||
| + | |||
| + | **JSON output example:** | ||
| + | <code> | ||
| + | {"response": | ||
| + | {"response_code":"200", | ||
| + | "response_description":"API key destroyed", | ||
| + | "response_time":"Fri, 05 Aug 2011 20:29:41", | ||
| + | "api_key":"80db3274f63128835425145be21311c4"} | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ==== Response codes ==== | ||
| + | |**Response code** |**Response description** | | ||
| + | |200|API key destroyed| | ||
| + | |201|Invalid API key| | ||
| + | |202|API key destroy error| | ||
| + | |||
| + | ===== activateKey call ===== | ||
| + | ==== Input ==== | ||
| + | * URL for XML output: https://secure.chilifresh.com/api/generatekey/ | ||
| + | * URL for JSON output: https://secure.chilifresh.com/api/generatekey/json/ | ||
| + | * Method: GET | ||
| + | ==== Parameters ==== | ||
| + | |**Parameter**|**Type (size)**|**Mandatory**|**Description**| | ||
| + | |account|Integer (10)|Yes|ChiliFresh library account ID| | ||
| + | |api_key|Varchar (32)|Yes|Valid API key| | ||
| + | ==== Output ==== | ||
| + | * Format: XML, JSON | ||
| + | * Blocks and elements: | ||
| + | |||
| + | |**Block** |**Element** |**Type (size)**|**Exists** |**Description** | | ||
| + | |**Block //response// starts**|||Always| | | ||
| + | |response|response_code|Integer (1)|Always|See reference below| | ||
| + | |response|response_description|Text (255)|Always|Brief description of response code| | ||
| + | |response|response_time|Date&time (D, d M Y H:i:s -hhmm)|Always|Example: Thu, 30 Jun 2010 07:25:58 -0500| | ||
| + | |response|api_key |Varchar(32) |If successful request |Reviews API key | | ||
| + | |**Block //response// ends**| | | | | | ||
| + | |||
| + | **XML input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/?account=1234&action=activateKey&api_key=asd90ais0d98a0s9d | ||
| + | </code> | ||
| + | |||
| + | **XML output example:** | ||
| + | <code> | ||
| + | <response> | ||
| + | <response_code>300</response_code> | ||
| + | <response_description>API key activated</response_description> | ||
| + | <response_time>Fri, 05 Aug 2011 20:47:50</response_time> | ||
| + | <api_key>80db3274f63128835425145be21311c4</api_key> | ||
| + | </response> | ||
| + | </code> | ||
| + | ---- | ||
| + | |||
| + | **JSON input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/json/?account=1234&action=activateKey&api_key=asd90ais0d98a0s9d | ||
| + | </code> | ||
| + | |||
| + | **JSON output example:** | ||
| + | <code> | ||
| + | {"response": | ||
| + | {"response_code":"300", | ||
| + | "response_description":"API key activated", | ||
| + | "response_time":"Fri, 05 Aug 2011 20:50:20", | ||
| + | "api_key":"80db3274f63128835425145be21311c4"} | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ==== Response codes ==== | ||
| + | |**Response code** |**Response description** | | ||
| + | |300|API key activated| | ||
| + | |301|API key already active| | ||
| + | |302|Invalid API key| | ||
| + | |303|API key activate error| | ||
| + | |||
| + | ===== deactivateKey call ===== | ||
| + | ==== Input ==== | ||
| + | * URL for XML output: https://secure.chilifresh.com/api/generatekey/ | ||
| + | * URL for JSON output: https://secure.chilifresh.com/api/generatekey/json/ | ||
| + | * Method: GET | ||
| + | ==== Parameters ==== | ||
| + | |**Parameter**|**Type (size)**|**Mandatory**|**Description**| | ||
| + | |account|Integer (10)|Yes|ChiliFresh library account ID| | ||
| + | |||
| + | |||
| + | ==== Output ==== | ||
| + | * Format: XML, JSON | ||
| + | * Blocks and elements: | ||
| + | |||
| + | |**Block** |**Element** |**Type (size)**|**Exists** |**Description** | | ||
| + | |**Block //response// starts**|||Always| | | ||
| + | |response|response_code|Integer (1)|Always|See reference below| | ||
| + | |response|response_description|Text (255)|Always|Brief description of response code| | ||
| + | |response|response_time|Date&time (D, d M Y H:i:s -hhmm)|Always|Example: Thu, 30 Jun 2010 07:25:58 -0500| | ||
| + | |response|api_key |Varchar(32) |If successful request |Reviews API key | | ||
| + | |**Block //response// ends**| | | | | | ||
| + | |||
| + | **XML input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/?account=1234&action=deactivateKey&api_key=asd90ais0d98a0s9d | ||
| + | </code> | ||
| + | |||
| + | **XML output example:** | ||
| + | <code> | ||
| + | <response> | ||
| + | <response_code>400</response_code> | ||
| + | <response_description>API key deactivated</response_description> | ||
| + | <response_time>Fri, 05 Aug 2011 20:47:50</response_time> | ||
| + | <api_key>80db3274f63128835425145be21311c4</api_key> | ||
| + | </response> | ||
| + | </code> | ||
| + | ---- | ||
| + | |||
| + | **JSON input example:** | ||
| + | <code> | ||
| + | https://secure.chilifresh.com/api/generatekey/json/?account=1234&action=deactivateKey&api_key=asd90ais0d98a0s9d | ||
| + | </code> | ||
| + | |||
| + | **JSON output example:** | ||
| + | <code> | ||
| + | {"response": | ||
| + | {"response_code":"400", | ||
| + | "response_description":"API key deactivated", | ||
| + | "response_time":"Fri, 05 Aug 2011 20:50:20", | ||
| + | "api_key":"80db3274f63128835425145be21311c4"} | ||
| + | } | ||
| + | </code> | ||
| + | ==== Response codes ==== | ||
| + | |**Response code** |**Response description** | | ||
| + | |400|API key deactivated| | ||
| + | |401|API key already inactive| | ||
| + | |402|Invalid API key| | ||
| + | |403|API key deactivate error| | ||
| + | |||
| + | ====== General errors ====== | ||
| + | |**Error code** |**Error description** | | ||
| + | |0|System error| | ||
| + | |1|Empty account ID| | ||
| + | |2|Action not specified| | ||