Alve API Access Application no longer accepts requests.

User Favorites Edit the file on GitHub

Note

To access any of the User Favorites endpoints, an access_token containing the favorites permission is required.

Table of Contents

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 and have_it: true attributes. This way owned favorites can be presented as a list.

List favorite lists

  GET /favorite_lists

GET https://api.alve.com/favorite_lists

View Response
Show Headers
Status: 200
{
  "favorite_lists": [
    {
      "id": -33,
      "name": "Cep Telefonu"
    }
  ],
  "meta": {
    "pagination": {
      "total_results": 1,
      "total_pages": 1,
      "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.alve.com/favorite_lists

View Response Params
{
  "favorite_list": {
    "name": "test name"
  }
}
Show Headers
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.alve.com/favorites

View Response
Show Headers
Status: 200
{
  "favorites": [
    {
      "id": 6301,
      "have_it": false,
      "user_id": 9529,
      "user_notes": null,
      "sku_id": 387159,
      "created_at": "2016-04-19T16:24:05+03:00",
      "updated_at": "2016-04-19T16:24:05+03:00",
      "get_absolute_threshold": null
    }
  ],
  "meta": {
    "pagination": {
      "total_results": 1,
      "total_pages": 1,
      "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.alve.com/favorite_lists/2845/favorites

View Response
Show Headers
Status: 200
{
  "favorites": [
    {
      "id": 6301,
      "have_it": false,
      "user_id": 9529,
      "user_notes": null,
      "sku_id": 387159,
      "created_at": "2016-04-19T16:24:05+03:00",
      "updated_at": "2016-04-19T16:24:05+03:00",
      "get_absolute_threshold": null
    }
  ],
  "meta": {
    "pagination": {
      "total_results": 1,
      "total_pages": 1,
      "page": 1,
      "per": 25
    }
  }
}

Retrieve a single favorite

  GET /favorites/:id

GET https://api.alve.com/favorites/13173

View Response
Show Headers
Status: 200
{
  "favorite": {
    "id": 13173,
    "have_it": false,
    "user_id": 9529,
    "user_notes": null,
    "sku_id": 5452491,
    "created_at": "2016-10-05T17:33:34+03:00",
    "updated_at": "2016-10-05T17:33:34+03:00",
    "get_absolute_threshold": null
  }
}

Create a new favorite

  POST /favorites

POST https://api.alve.com/favorites

View Response Params
{
  "favorite": {
    "sku_id": 7957675
  }
}
Show Headers
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.alve.com/favorites/17832353

View Response Params
{
  "favorite": {
    "have_it": true
  }
}
Show Headers
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
  }
}