API Endpoints ============= Root ---- .. http:get:: /1.1/ Retrieve a list of resources. .. sourcecode:: js { "authentication": { "token": { "expires": "2015-09-07T17:04:59+0300", "id": "1e0bb382298a103578b2801527b4dbca", "startTime": "2015-09-07T16:04:59+0300" } }, "links": { "self": "https://api.huuto.net/1.1/authentication", "user": "https://api.huuto.net/1.1/users/966898" }, "updated": "2015-09-07T16:04:59+0300" } Authentication -------------- .. http:post:: /1.1/authentication Authenticate with userid and password. Method call returns a token id, which can be sent as the *X-HuutoApiToken* header field. Also token expiration time is returned as part of the data. Userid is the same userid used for Huuto.net. If you do not already have an account, you can register one through the main site (http://www.huuto.net). :param username: user's username :type username: string :param password: password :type password: string :status 400: when form parameters are missing or invalid username/password :status 201: authentication token created **Example response**: .. sourcecode:: js { "authentication": { "token": { "expires": "2015-09-07T17:04:59+0300", "id": "1e0bb382298a103578b2801527b4dbca", "startTime": "2015-09-07T16:04:59+0300" } }, "links": { "self": "https://api.huuto.net/1.1/authentication", "user": "https://api.huuto.net/1.1/users/966898" }, "updated": "2015-09-07T16:04:59+0300" } Bids ---- Getting item's bids ^^^^^^^^^^^^^^^^^^^ .. http:get:: /1.1/items/{itemid}/bids Retrieve information about item's bids :param itemid: item's id :type itemid: int Making a bid ^^^^^^^^^^^^ .. http:post:: /1.1/items/{itemid}/bids :param itemid: item's id :type itemid: int :param bid: bid amount (euros), eg. "16.50" :type bid: float :param automate: Bidding automation. With automate on, bid parameter is considered to be the **maximum amount** the user is willing to pay. Bidding automation system will take care of the bidding process on behalf of the user and try to win the item with the smallest possible price. :type automate: int (0 = no, 1 = yes). Default 0. :param quantityMin: Minimum quantity user is bidding for. Applies to items which have a quantity of more than one (eg. one is selling 10 USB sticks). Required if item has a quantity of more than one. Currently only buy-now items can have a quantity of more than one. :type quantityMin: int :param quantityMax: Maximum quantity user is bidding for. Required if item has a quantity of more than one. (See more info above.) :type quantityMax: int Categories ---------- Listing categories ^^^^^^^^^^^^^^^^^^ .. http:get:: /1.1/categories/ Retrieve category listing. Huuto has a 3-level category system. :param max-depth: multiple hierarchy levels can be fetched in a single call :type max-depth: int (1, 2, 3) **Example response**: .. sourcecode:: js { "categories": [ { "id": 1, "links": { "items": "https://api.huuto.net/1.1/categories/1/items", "self": "https://api.huuto.net/1.1/categories/1", "subcategories": "https://api.huuto.net/1.1/categories/1/subcategories" }, "title": "Ajoneuvot" }, { "id": 27, "links": { "items": "https://api.huuto.net/1.1/categories/27/items", "self": "https://api.huuto.net/1.1/categories/27", "subcategories": "https://api.huuto.net/1.1/categories/27/subcategories" }, "title": "Antiikki" }, { "id": 86, "links": { "items": "https://api.huuto.net/1.1/categories/86/items", "self": "https://api.huuto.net/1.1/categories/86", "subcategories": "https://api.huuto.net/1.1/categories/86/subcategories" }, "title": "Elokuvat" } ], "id": 0, "links": { "items": "https://api.huuto.net/1.1/items", "self": "https://api.huuto.net/1.1/categories" }, "title": "Huuto.net categories", "updated": "2015-09-08T13:05:33+0300" } Category info ^^^^^^^^^^^^^ .. http:get:: /1.1/categories/ Retrieve information regarding a single category. :param categoryid: Category id :type categoryid: int **Example response (shortened)**: .. sourcecode:: js { "id": 375, "links": { "items": { "closed": "http://api.huuto.net/1.1/categories/375/items/closed", "closing": "http://api.huuto.net/1.1/categories/375/items/closing", "gallery": "http://api.huuto.net/1.1/galleries/category/375", "open": "http://api.huuto.net/1.1/categories/375/items", "recent": "http://api.huuto.net/1.1/categories/375/items/recent" }, "self": "http://api.huuto.net/1.1/categories/375", "subcategories": "http://api.huuto.net/1.1/categories/375/subcategories" }, "title": "Lastentarvikkeet", "updated": "2015-09-08T13:35:57+0300" } Category items ^^^^^^^^^^^^^^ .. http:post:: /1.1/categories/ Retrieve category items. :param categoryid: Category id :type categoryid: int **Example response (shortened)**: .. sourcecode:: js { "items": [ { "bidderCount": 0, "buyNowPrice": 19, "category": "Poikien vaatepaketit", "closingTime": "2015-09-09T23:29:35+0300", "currentPrice": 19, "hasReservePrice": false, "hasReservePriceExceeded": false, "id": 362545037, "images": [ { "links": { "medium": "http://kuvat.huuto.net/e/ca/c2ea29b2466ae4aea256592ee8493-m.jpg", "original": "http://kuvat.huuto.net/e/ca/c2ea29b2466ae4aea256592ee8493-orig.jpg", "self": "http://api.huuto.net/1.1/items/362545037/images/261771540", "thumbnail": "http://kuvat.huuto.net/e/ca/c2ea29b2466ae4aea256592ee8493-s.jpg" } } ], "links": { "alternative": "http://www.huuto.net/kohteet/retrovaatepaketti-pojalle-100-140cm/362545037", "category": "http://api.huuto.net/1.1/categories/740", "images": "http://api.huuto.net/1.1/items/362545037/images", "self": "http://api.huuto.net/1.1/items/362545037" }, "listTime": "2015-05-12T23:30:32+0300", "location": "akaa", "offerCount": 0, "postalCode": "37800", "saleMethod": "buy-now", "seller": "jannehautamaki", "sellerId": 1396547, "title": "retrovaatepaketti pojalle 100-140cm ", "upgrades": [] }, { "bidderCount": 0, "buyNowPrice": 0, "category": "Poikien vaatepaketit", "closingTime": "2015-09-08T17:58:06+0300", "currentPrice": 15, "hasReservePrice": false, "hasReservePriceExceeded": false, "id": 374721944, "images": [ { "links": { "medium": "http://kuvat.huuto.net/d/5e/040f8e3416cab9b36a852baf2dafd-m.jpg", "original": "http://kuvat.huuto.net/d/5e/040f8e3416cab9b36a852baf2dafd-orig.jpg", "self": "http://api.huuto.net/1.1/items/374721944/images/276066506", "thumbnail": "http://kuvat.huuto.net/d/5e/040f8e3416cab9b36a852baf2dafd-s.jpg" } } ], "links": { "alternative": "http://www.huuto.net/kohteet/110---116---122-cm-pojan-vaatepaketti-mm-lego-hm-lindex/374721944", "category": "http://api.huuto.net/1.1/categories/740", "images": "http://api.huuto.net/1.1/items/374721944/images", "self": "http://api.huuto.net/1.1/items/374721944" }, "listTime": "2015-08-25T17:58:06+0300", "location": "Kuusankoski", "offerCount": 0, "postalCode": "45740", "saleMethod": "auction", "seller": "Pimpuli", "sellerId": 503013, "title": "110 - 116 - 122 cm pojan vaatepaketti, mm. Lego H&M lindex", "upgrades": [] }, { "bidderCount": 0, "buyNowPrice": 0, "category": "Poikien vaatepaketit", "closingTime": "2015-09-09T08:21:52+0300", "currentPrice": 6, "hasReservePrice": false, "hasReservePriceExceeded": false, "id": 374790607, "images": [ { "links": { "medium": "http://kuvat.huuto.net/f/6a/2c75e33113761a25e2d939cd92f17-m.jpg", "original": "http://kuvat.huuto.net/f/6a/2c75e33113761a25e2d939cd92f17-orig.jpg", "self": "http://api.huuto.net/1.1/items/374790607/images/246408952", "thumbnail": "http://kuvat.huuto.net/f/6a/2c75e33113761a25e2d939cd92f17-s.jpg" } } ], "links": { "alternative": "http://www.huuto.net/kohteet/collegehousut-104_110-ja-pitkahihainen-paita-koko-110-lindex/374790607", "category": "http://api.huuto.net/1.1/categories/740", "images": "http://api.huuto.net/1.1/items/374790607/images", "self": "http://api.huuto.net/1.1/items/374790607" }, "listTime": "2015-08-26T08:21:52+0300", "location": "Turku", "offerCount": 0, "postalCode": "20320", "saleMethod": "auction", "seller": "ravvravv", "sellerId": 686933, "title": "collegehousut 104/110 ja pitk\u00e4hihainen paita koko 110 Lindex", "upgrades": [] } ], "links": { "first": "http://api.huuto.net/1.1/categories/375/items?page=1&category=375", "gallery": "http://api.huuto.net/1.1/galleries/items?category=375", "hits": "http://api.huuto.net/1.1/hits?category=375", "last": "http://api.huuto.net/1.1/categories/375/items?page=2172&category=375", "next": "http://api.huuto.net/1.1/categories/375/items?page=2&category=375", "previous": null, "self": "http://api.huuto.net/1.1/categories/375/items?page=1&category=375" }, "totalCount": 108560, "updated": "2015-09-08T14:06:07+0300" } Items ----- Creating a new item ^^^^^^^^^^^^^^^^^^^ .. http:post:: /1.1/items/ Create a new item. Note: Optional parameters are listed last and marked as optional. :param buyNowPrice: Buy now price. Required when sale method is "buy-now". :type buyNowPrice: float :param categoryId: Item's category id :type categoryId: int :param closingTime: together with listTime, alternative to openDays :type closingTime: string - eg. '2016-12-04 18:55:20' :param condition: item's condition :type condition: ``new`` - uusi, ``like-new`` - uudenveroinen, ``good`` - hyvä, ``acceptable`` - tyydyttävä, ``weak`` - heikko :param description: item's description :type description: string :param deliveryMethods: delivery methods :type deliveryMethods: array - ``pickup``, ``shipment``. Note: array! :param deliveryTerms: delivery terms :type deliveryTerms: string :param identificationRequired: Require identification from buyers (optional, default 0). Option available for Huuto Plus users. :type identificationRequired: int - 0 or 1, boolean :param isLocationAbroad: If item is located outside of Finland or not. Default 0 (no). If set to 1, postalCode does not need to be used. :type isLocationAbroad: int - 0 or 1, boolean :param listTime: together with closingTime, alternative to openDays (optional, defaults to current time) :type listTime: string - eg. '2016-11-20 19:26:00' :param marginalTax: Is marginal tax used or not. Available for company users. :type marginalTax: int - 0 or 1, boolean :param minimumFeedback: minimum user feedback points required for buying/bidding (ostajien rajaaminen palautepistemäärän perusteella). Option available for Huuto Plus users. :type minimumFeedback: int :param minimumIncrease: Minimum increase for bidding. (Not available for regular users. Required for Huuto Plus users, who can set this value freely.) Used only when sale method is "auction". :type minimumIncrease: float :param openDays: amount of days item will be available for selling :type openDays: int :param originalId: originalId can be used to easily republish an old, closed item. Title, description, sell method, price, images and other data will get copied from the previous into newly created item, which will have a "draft" status by default. To publish it, its status must be updated to "preview" and after that, to "published". :type originalId: int :param paymentMethods: payment methods :type paymentMethods: array - ``wire-transfer``, ``cash``, ``mobile-pay``. Multiple options can be sent. Note: array! :param paymentTerms: payment terms :type paymentTerms: string - payment terms description, max. 1000 chars :param postalCode: Finnish postal code. Mandatory field by default. However, if isLocationAbroad parameter is set to 1, postalCode is not required. :type postalCode: string - eg. '00100' :param quantity: Quantity available for selling. Mandatory for buy-now items, where minimum is 1. Optional for auction items (set to 1 automatically). :type quantity: int :param republish: Republish item (optional). If not sold, item will be republished automatically. Can be used for items that are open more than 3 days. Option is available only for Huuto Plus users. :type republish: int - 0 or 1, boolean :param saleMethod: item's selling method :type saleMethod: string - ``auction``, ``buy-now``. Note: "Hybrid" method is no longer available. :param startingPrice: Starting price for bidding. Required when sale method is "auction". :type startingPrice: float :param status: item's status - When creating a new item, status will be "preview" by default. :type status: string - ``draft``, ``preview``, ``published``, ``closed``, ``disabled``, ``waiting`` :param title: Item's title :type title: string - max. 60 chars :param vat: Used vat rate as a percentage. Available for companies. :type vat: int - between 0-100 :param offersAllowed: Allow offers from users. Allowed by default. :type offersAllowed: int - 0 or 1, boolean .. note:: **More info about STATUS**: To publish an item, you have to update your item's status to "published" via a PUT request (see below for details). Item can not becreated directly into published state. Item can be created with draft status in which case no additional parameters are required. This is useful if an application wants to save item images before asking other parameters from user. **Example response**: .. sourcecode:: js { "links": { ... }, "bidderCount": 0, "buyNowPrice": 50, "closingTime": "2014-08-18T14:19:20+0300", "condition": "new", "currentPrice": 50, "deliveryMethods": [], "deliveryPrice": null, "description": "
Kohteen kuvaus
", "hasReservePrice": false, "hasReservePriceExceeded": false, "id": 123456789, "images": [], "listTime": "2014-08-08T14:19:20+0300", "location": "Helsinki", "mainCategory": { "id": 1, "name": "Ajoneuvot" }, "minimumIncrease": 0, "paymentMethods": [], "postalCode": "", "quantity": 1, "requirements": { "identificationRequired": false, "minimumFeedback": 0 }, "saleMethod": "buy-now", "sectionCategory": { "id": 2, "name": "Autojen varusteet ja varaosat" }, "seller": "huutonet-testi", "startingPrice": 50, "status": "preview", "subCategory": { "id": 3, "name": "Autojen lis\u00e4varusteet" }, "vat": 24, "deliveryTerms": "", "title": "Testikohde 123", "updated": "2014-08-08T14:20:36+0300", "upgrades": [] } Editing item ^^^^^^^^^^^^ .. http:put:: /1.1/items/{itemid} Editing items can be done via PUT requests. Items can be edited only in preview or draft state. Edit accepts the same parameters as with item creation (see above for reference). :reqheader X-HuutoApiToken: token received via login (required) Setting item's status ^^^^^^^^^^^^^^^^^^^^^ .. http:put:: /1.1/items/{itemid} When creating a new item, it's status will be "preview" by default. To publish an item, it's status will need to be updated to "published". When item status is updated to published only status is changed even if the request contains additional parameters. :reqheader X-HuutoApiToken: token received via login (required) :param status: item's status :type status: string - ``draft``, ``preview``, ``published``, ``closed`` **draft** - Create item with "draft" status. It will return an item object with a valid item id. Put requests can be used to update item's data. Also images can be added to item. Next step is to update the item's status to "preview". .. note:: There is 10 draft item limit per user. Draft items previously created by a user can be found in user sales resource: /1.1/users/{userno}/sales/?status=draft **preview** - Set item's status to "preview". At this point all saved data will be validated. After a successful "preview", an item can published. **published** - Publish an item and make it available for selling. **closed** - Close item. After closing item is no longer available for bidding, offering etc. Highest bidder will win, if other conditions (eg. price reservation) are met. Listing and searching ^^^^^^^^^^^^^^^^^^^^^ .. http:get:: /1.1/items Item search. Various parameters can be used. :param addtime: item's list time :type addtime: string - ``past-day``, ``past-2days``, ``past-5days``, ``past-week`` :param area: city, municipality or zipcode :type area: string - eg. "Helsinki", "Uusimaa", "00100" :param biddernro: bidder's numeric user id :type biddernro: int :param category: category's id, multiple category id's can be separated with commas or dashes, eg. ``1-2-3`` :type category: int | string :param condition: item's condition :type condition: string - ``none`` - ei määritelty, ``new`` - uusi, ``like-new`` - uudenveroinen, ``good`` - hyvä, ``acceptable`` - tyydyttävä, ``weak`` - heikko :param closingtime: item's list time :type closingtime: string - ``next-day``, ``next-2days``, ``next-5days``, ``next-week`` :param feedback_limit: filter by user's feedback value :type feedback_limit: int :param limit: items per page limit :type limit: int (50 | 500) - default is 50 :param page: result set page number :type page: int :param price_max: maximum price :type price_max: float :param price_min: minimum price :type price_min: float :param seller_type: seller's type, default is all. :type seller_type: string - ``company``, ``user`` :param sellernro: seller's numeric user id :type sellernro: int :param sellstyle: item's selling method :type sellstyle: string - ``all``, ``auction``, ``buy-now`` :param sort: result rest sorting :type sort: string - ``hits``, ``newest``, ``closing``, ``lowprice``, ``highprice``, ``bidders``, ``title``. Default is "hits". :param status: item's status :type status: string - ``open``, ``closed`` :param words: search string :type words: string **Example request**: .. sourcecode:: http GET /1.1/items?words=lada samara forma iskunvaimentimet HTTP/1.1 Host: api.huuto.net Accept: application/json, text/javascript **Example response**: .. sourcecode:: js test Getting item data ^^^^^^^^^^^^^^^^^ .. http:get:: /1.1/items/{itemid} Retrieve item's data. :param itemid: item's id :type itemid: int Delete draft item ^^^^^^^^^^^^^^^^^ .. http:delete:: /1.1/items/{itemid} Items in *draft* status can be deleted via DELETE requests. :reqheader X-HuutoApiToken: token received via login (required) Images ------ Getting item images ^^^^^^^^^^^^^^^^^^^ .. http:get:: /1.1/items/{itemid}/images Retrieve images related to item. :param itemid: item's id :type itemid: int **Example response**: .. sourcecode:: js { "images": [ { "links": { "medium": "https://kuvat.huuto.net/0/64/eea869a811b177cf79b20f70d876c-m.jpg", "original": "https://kuvat.huuto.net/0/64/eea869a811b177cf79b20f70d876c-orig.jpg", "self": "https://api.huuto.net/1.1/items/123456789/images/261894141", "thumbnail": "https://kuvat.huuto.net/0/64/eea869a811b177cf79b20f70d876c-s.jpg" } } ], "links": { "self": "https://api.huuto.net/1.1/items/123456789/images" }, "updated": "2014-08-12T10:53:56+0300" } Adding an image to item ^^^^^^^^^^^^^^^^^^^^^^^ .. http:post:: /1.1/items/{itemid}/images Post an image to item. Item must exist before images can be added. Item must be in *preview* or *draft* state. Creating an item with *draft* status is useful if the application wants to save item images before asking any other parameters from the user. When request status is *draft*, no additional parameters are required. :reqheader X-HuutoApiToken: token received via login (required) :param itemid: item's id (already present in the url) :type itemid: int :param image: image file :type image: file **Example response**: .. sourcecode:: js { "links": { "image": "http://api.huuto.net/1.1/items/322184647/images/12345678" } } .. note:: Maximum file upload size is 8 MB. **Example CURL request** Here's an example of adding an image using CURL: .. sourcecode:: bash $ curl -i -F 'image=@/path/imagefile.jpg' -H 'X-HuutoApiToken: