Check if favorited interface

Check if a specified product or document has been favorited by the current user, supporting single or batch query of favorite status.

Precautions

  • This interface uses the POST method and requires data to be submitted in application/ format
  • Provide document ID or an array of document IDs.
  • Supports query of favorite status for logged-in users only
  • Supports query of a single document and batch query
  • The returned favorite records include detailed information such as favorite time

Request address

{ๅŸŸๅๅœฐๅ€}/api/favorite/check

Description:{ๅŸŸๅๅœฐๅ€}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/favorite/check

Request syntax

POST {ๅŸŸๅๅœฐๅ€}/api/favorite/check
Content-Type: application/json

Request header

This interface only involves public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request Parameters

Field Name Type Required Description
archive_id integer No Document ID, either one of archive_ids
archive_ids int[] No Document ID array, supports batch queries, either/or with archive_id

Note: archive_idandarchive_idsEither parameter, use the priority onearchive_idsPerform batch query

Response Headers

This interface only involves public response headers. More information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field Name Type Description
code integer Error code
message string Error Description
data array Return array of favorite data

Data array element parameter

Field Name Type Description
id integer Favorite record ID
archive_id integer Document ID
sku_id integer SKU ID (if applicable)
user_id integer User ID
create_time integer Favorite timestamp

Example Usage

Example of a single document query request

POST /api/favorite/check HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "archive_id": 1
}

Batch Document Query Request Example

POST /api/favorite/check HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "archive_ids": [1, 2, 3, 5]
}

Single Document Query Response Example

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "id": 1,
      "archive_id": 1,
      "sku_id": 0,
      "user_id": 1,
      "create_time": 1592282639
    }
  ]
}

Batch Document Query Response Example

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "id": 1,
      "archive_id": 1,
      "sku_id": 0,
      "user_id": 1,
      "create_time": 1592282639
    },
    {
      "id": 3,
      "archive_id": 3,
      "sku_id": 0,
      "user_id": 1,
      "create_time": 1592285000
    }
  ]
}

Unfavorite Response Example

{
  "code": 0,
  "msg": "",
  "data": []
}

Error Code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Unauthorized
200 API request OK