User Favorites Edit the file on GitHub
Note
To access any of the User Favorites endpoints, an
access_token
containing thefavorites
permission is required.
Table of Contents
- Types of Favorite Lists
- List favorite lists
- Create a favorite_list
- Destroy a favorite_list
- List favorites
- List favorites belonging to list
- Retrieve a single favorite
- Create a new favorite
- Destroy a favorite
- Update a favorite
Types of Favorite Lists
User may pick one or more SKUs as favorites. Favorites are organized in favorite_lists
.
3 types of favorite_lists
exist:
- Custom lists
- Can contain SKUs from different categories. These are created by the user.
- Auto lists
- These are connected with a category and can only contain favorite SKUs
from this category. These are created automatically when a new favorite is
created without specifying a
favorite_list
. - "Owned" list
- This is a special list that includes favorites that the user has
flagged as "owned". Items in the list have
favorite_list_id: null
andhave_it: true
attributes. This way owned favorites can be presented as a list.
List favorite lists
GET /favorite_lists
GET https://api.skroutz.gr/favorite_lists
View ResponseStatus: 200
{
"favorite_lists": [
{
"id": 679365,
"name": "test",
"category_id": null
},
{
"id": 861839,
"name": "mobile",
"category_id": null
},
{
"id": 881601,
"name": "a new list name",
"category_id": null
},
{
"id": -1448,
"name": "Γυναικεία Πέδιλα"
},
{
"id": -828,
"name": "Ανδρικές Ζώνες"
},
{
"id": -1577,
"name": "Ανδρικά T-shirts"
},
{
"id": -821,
"name": "Γυναικείες Τσάντες"
},
{
"id": -790,
"name": "Γυαλιά Ηλίου"
},
{
"id": -1763,
"name": "Flat Μποτάκια"
},
{
"id": -1776,
"name": "Ανδρικά Αρώματα"
},
{
"id": -334,
"name": "Ανδρικά Ρολόγια"
},
{
"id": -40,
"name": "Κινητά Τηλέφωνα"
},
{
"id": -712,
"name": "Βάσεις & Docking Stations"
},
{
"id": -34,
"name": "Βιβλία"
},
{
"id": -435,
"name": "Bluetooth Handsfree"
},
{
"id": -12,
"name": "Τηλεοράσεις"
},
{
"id": -582,
"name": "Μπαταρίες Κινητών Τηλεφώνων"
},
{
"id": -1632,
"name": "Διάφορα Αξεσουάρ Tablet"
},
{
"id": -1413,
"name": "PS4 Games"
},
{
"id": -1748,
"name": "Power Banks"
},
{
"id": -1373,
"name": "Γυαλιά 3D"
},
{
"id": -88,
"name": "SSD Σκληροί Δίσκοι"
},
{
"id": -345,
"name": "Μίκτες & Κονσόλες"
},
{
"id": -1743,
"name": "After Shave"
},
{
"id": -1511,
"name": "Πιστολάκια Μαλλιών"
}
],
"meta": {
"pagination": {
"total_results": 48,
"total_pages": 2,
"page": 1,
"per": 25
}
}
}
Create a favorite_list
It trying to create a custom list with the same name as an existing custom list you will be presented with an error message.
POST /favorite_lists
POST https://api.skroutz.gr/favorite_lists
View Response Params{
"favorite_list": {
"name": "test name"
}
}
Status: 201
{
"favorite_list": {
"id": 973812,
"name": "test name",
"category_id": null,
"type": "custom"
}
}
Destroy a favorite_list
The response status is 204 and with an empty response body when resource is destroyed. Status code is 404 when the resource does not exist.
DELETE /favorite_lists/:id
List favorites
The parameter owned
can be set to true
to fetch only owned favorites.
By default favorites are sorted by creation date descending. order_dir=asc
can
be used to fetch them with ascending order.
Linked Resources
Favorites contain the following linked resources:
GET /favorites
GET https://api.skroutz.gr/favorites
View ResponseStatus: 200
{
"favorites": [
{
"id": 7927460,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8333136,
"created_at": "2017-02-01T13:15:07+02:00",
"updated_at": "2017-02-01T13:15:07+02:00",
"get_absolute_threshold": null
},
{
"id": 7926151,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8221632,
"created_at": "2017-02-01T11:23:14+02:00",
"updated_at": "2017-02-06T22:11:59+02:00",
"get_absolute_threshold": null
},
{
"id": 7908464,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8811547,
"created_at": "2017-01-31T12:28:24+02:00",
"updated_at": "2017-01-31T12:28:24+02:00",
"get_absolute_threshold": null
},
{
"id": 7908446,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8864706,
"created_at": "2017-01-31T12:26:22+02:00",
"updated_at": "2017-02-06T22:07:15+02:00",
"get_absolute_threshold": null
},
{
"id": 7781595,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6290142,
"created_at": "2017-01-25T14:19:09+02:00",
"updated_at": "2017-02-06T08:12:09+02:00",
"get_absolute_threshold": null
},
{
"id": 7781579,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9521654,
"created_at": "2017-01-25T14:17:50+02:00",
"updated_at": "2017-02-01T16:17:35+02:00",
"get_absolute_threshold": null
},
{
"id": 7781577,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9507966,
"created_at": "2017-01-25T14:17:48+02:00",
"updated_at": "2017-02-04T02:13:26+02:00",
"get_absolute_threshold": null
},
{
"id": 7690286,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9994262,
"created_at": "2017-01-20T17:13:05+02:00",
"updated_at": "2017-01-20T17:13:05+02:00",
"get_absolute_threshold": null
},
{
"id": 7685105,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9884904,
"created_at": "2017-01-20T12:07:30+02:00",
"updated_at": "2017-01-20T12:07:30+02:00",
"get_absolute_threshold": null
},
{
"id": 7650441,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7326088,
"created_at": "2017-01-18T13:27:20+02:00",
"updated_at": "2017-01-18T13:27:20+02:00",
"get_absolute_threshold": "19.11"
},
{
"id": 7247164,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6776814,
"created_at": "2016-12-29T15:25:11+02:00",
"updated_at": "2016-12-29T15:25:11+02:00",
"get_absolute_threshold": null
},
{
"id": 7247163,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9899808,
"created_at": "2016-12-29T15:25:09+02:00",
"updated_at": "2017-01-04T10:26:11+02:00",
"get_absolute_threshold": null
},
{
"id": 7247161,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8767893,
"created_at": "2016-12-29T15:25:08+02:00",
"updated_at": "2016-12-31T20:36:09+02:00",
"get_absolute_threshold": null
},
{
"id": 7247160,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9526902,
"created_at": "2016-12-29T15:25:07+02:00",
"updated_at": "2017-01-14T18:10:39+02:00",
"get_absolute_threshold": null
},
{
"id": 7228640,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7934886,
"created_at": "2016-12-28T17:25:42+02:00",
"updated_at": "2016-12-28T17:25:42+02:00",
"get_absolute_threshold": null
},
{
"id": 7228635,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 5370592,
"created_at": "2016-12-28T17:25:22+02:00",
"updated_at": "2016-12-28T17:25:22+02:00",
"get_absolute_threshold": null
},
{
"id": 7228634,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7039829,
"created_at": "2016-12-28T17:25:20+02:00",
"updated_at": "2016-12-28T17:25:20+02:00",
"get_absolute_threshold": null
},
{
"id": 7228633,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7039658,
"created_at": "2016-12-28T17:25:19+02:00",
"updated_at": "2016-12-28T17:25:19+02:00",
"get_absolute_threshold": null
},
{
"id": 7227564,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 9572084,
"created_at": "2016-12-28T16:31:26+02:00",
"updated_at": "2017-01-20T12:39:29+02:00",
"get_absolute_threshold": null
},
{
"id": 7225283,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 8435610,
"created_at": "2016-12-28T14:37:48+02:00",
"updated_at": "2016-12-28T14:37:48+02:00",
"get_absolute_threshold": null
},
{
"id": 6976116,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7904356,
"created_at": "2016-12-13T09:55:55+02:00",
"updated_at": "2016-12-13T09:55:55+02:00",
"get_absolute_threshold": null
},
{
"id": 6697531,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 360622,
"created_at": "2016-11-26T14:41:24+02:00",
"updated_at": "2017-01-26T14:41:28+02:00",
"get_absolute_threshold": null
},
{
"id": 6453090,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7957675,
"created_at": "2016-11-11T15:22:32+02:00",
"updated_at": "2016-12-10T10:22:14+02:00",
"get_absolute_threshold": null
},
{
"id": 6194028,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6535417,
"created_at": "2016-10-25T12:24:14+03:00",
"updated_at": "2017-01-09T20:14:45+02:00",
"get_absolute_threshold": null
},
{
"id": 6194026,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6999182,
"created_at": "2016-10-25T12:24:11+03:00",
"updated_at": "2017-01-15T02:19:10+02:00",
"get_absolute_threshold": null
}
],
"meta": {
"pagination": {
"total_results": 124,
"total_pages": 5,
"page": 1,
"per": 25
}
}
}
List favorites belonging to list
The response contains only favorites belonging to the specified favorite list.
GET /favorite_lists/:id/favorites
GET https://api.skroutz.gr/favorite_lists/861839/favorites
View ResponseStatus: 200
{
"favorites": [
{
"id": 3423493,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7423345,
"created_at": "2016-02-25T16:21:11+02:00",
"updated_at": "2016-11-08T20:08:21+02:00",
"get_absolute_threshold": null
},
{
"id": 6194024,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 10001441,
"created_at": "2016-10-25T12:24:06+03:00",
"updated_at": "2016-10-25T12:24:06+03:00",
"get_absolute_threshold": null
},
{
"id": 6194026,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6999182,
"created_at": "2016-10-25T12:24:11+03:00",
"updated_at": "2016-10-25T12:24:11+03:00",
"get_absolute_threshold": null
},
{
"id": 6194028,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 6535417,
"created_at": "2016-10-25T12:24:14+03:00",
"updated_at": "2016-10-25T12:24:14+03:00",
"get_absolute_threshold": null
}
],
"meta": {
"pagination": {
"total_results": 4,
"total_pages": 1,
"page": 1,
"per": 25
}
}
}
Retrieve a single favorite
GET /favorites/:id
GET https://api.skroutz.gr/favorites/5896665
View ResponseStatus: 200
{
"favorite": {
"id": 5896665,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 89645,
"created_at": "2016-10-05T16:55:07+03:00",
"updated_at": "2016-10-05T16:55:07+03:00",
"get_absolute_threshold": null
}
}
Create a new favorite
POST /favorites
POST https://api.skroutz.gr/favorites
View Response Params{
"favorite": {
"sku_id": 7957675
}
}
Status: 201
{
"favorite": {
"id": 17832353,
"have_it": false,
"user_id": 334941,
"user_notes": null,
"sku_id": 7957675,
"created_at": "2018-01-31T13:22:26+02:00",
"updated_at": "2018-01-31T13:22:26+02:00",
"get_absolute_threshold": null
}
}
Destroy a favorite
The response status is 204 and with an empty response body when resource is destroyed. Status code is 404 when the resource does not exist.
DELETE /favorites/:id
Update a favorite
A favorite update might be called to do one of the following:
- Move the favorite to an other list (custom probably)
- Mark favorite as "owned" (through have_it: true)
- Add the favorite to a new custom list
When a favorite is have_it: true
, it does not belong to a favorite_list.
If you put a favorite_list_id and have_it: true
, then only have_it will be
respected (favorite_list_id will be ignored).
You may choose to create a new custom list when creating or updating a favorite,
by specifying the parameter new_list_name
. A new custom list will be created
(if it does not exist) with the given name and the favorite will be assigned
to it, have_it
attribute will be set to null
.
In case of an error, status 400 will be returned with errors in response body.
PUT /favorites/:id?have_it=true
PUT https://api.skroutz.gr/favorites/17832353
View Response Params{
"favorite": {
"have_it": true
}
}
Status: 200
{
"favorite": {
"id": 17832353,
"have_it": true,
"user_id": 334941,
"user_notes": null,
"sku_id": 7957675,
"created_at": "2018-01-31T13:22:26+02:00",
"updated_at": "2018-01-31T13:24:35+02:00",
"get_absolute_threshold": null
}
}