Showing results for 
Search instead for 
Do you mean 

Foundation - Favorites API

by Technical Evangelist on ‎11-09-2016 12:12 PM (508 Views)

Foundation - Favorites API

The Favorites API is used to classify catalog items as favorites for the current user. This API provides developers the ability to fetch a list of all catalog items classified as a favorite, classify a list of catalog items as favorites, and to remove the favorite classification from a catalog item.

 

Request all items classified as favorite

Returns a json array of catalog item ids that have been classified as favorites for the current user.

 

Request Endpoint:
GET /api/v1/favorites.json

 

Successful HTTP Response Code:
HTTP Status Code Description Payload
200 Successfully retrieved all catalog items with favorites classification
{
  "_encodingVersion": "string",
  "_encodingTime": 0,
  "context": {
    "totalAvailableResults": 0,
    "queryParameters": {},
    "maxResults": 0,
    "startIdx": 0,
    "queryTimeMillis": 0,
    "rootPath": "string",
    "_class": "string"
  },
  "results": [
    {
      "name": "string",
      "defaultAttachmentName": "string",
      "id": "string",
      "_class": "string",
      "title": "string",
      "parentId": "string"
    }
  ]
}

 

Error Response:
HTTP Status Code Description Payload
401 Unauthorized
{
    error: "string",
    error_description: "string"
}
404 No results in Catalog
{
    "_encodingVersion": "string",
    "_encodingTime": 0,
    "errorMessage": "string"
}
500 Unexpected Error
{
    "error": "string",
    "error_description": "string"
}

 

 

Modify catalog items to be classified as favorites

Takes a list of catalog items and classifies each as a favorite for the current user.

 

Request Endpoint:
POST /api/v1/favorites.json

 

 

Request Parameters:
Title Required Type Values Description
ids true Array[String] Any set of valid catalog item ids Array of ids to be classified as favorites

 

Sample Request Payload:
{
    "ids": [
        "string",
        "string",
        ...
    ]
}

 

Successul Response:
HTTP Status Code Description Payload
204 Successfully classified catalog items as favorites. There is no payload for this response.

Error Response:
HTTP Code Description Payload
401 Unauthorized
{
    "error": "string",
    "error_description": "string"
}
500 Unexpected Error

 

 

Remove the favorite classification from a catalog item

Takes a single catalog item and removes the favorites classification.

 

Request Endpoint:
DELETE /api/v1/favorites/{ID}

 

Request Parameters:
Title Required Type Values Description
Id true QueryString Parameter Any valid catalog item id Id of the catalog item to be classified as a favorite.

 

Successful Response:
HTTP Status Code Description Payload
204 Successfully removed favorites classification from catalog item. There is no payload for this response.

Error Response:
HTTP Status Code Description Payload
401 Unauthorized
{
    "error": "string",
    "error_description": "string"
}
404 No results in Catalog
{
    "_encodingVersion": "string",
    "_encodingTime": 0,
    "errorMessage": "string"
}
500 Unexpected Error
{
    "error": "string",
    "error_description": "string"
}
Contributors