Skip to main content

Filtering API responses by content category

Use the contents_type parameter to filter the results by content category.

Example Content​

Check the results when filtering the following content:

Topic IDTitleContent Category IDCategory Name
1152Article of parent category17Parent NEWS
1153Article of child category54Child NEWS
1154Article of grandchild category55Grandchild NEWS
  • Content Category Settings:
    Image from Gyazo

  • Content List:
    Image from Gyazo

Narrowing down by contents_type​

Filtering by contents_type does not consider the parent-child relationships in content categories. Therefore, the list of content belonging to the specified content category is returned.

Filtering by contents_type=[17]​

Only "Article of parent category" is displayed.

Request URL:
https://example.g.kuroco.app/rcms-api/13/news?contents_type%5B%5D=17

Response body:

{
"errors": [],
"messages": [],
"list": [
{
"topics_id": 1152,
"ymd": "2023-02-16",
"contents_type": 17,
"contents": "",
"subject": "Article of parent category",
・
・
・
}
],
"pageInfo": {
"totalCnt": 1,
・
・
・
}
}

Filtering by contents_type=[17,54]​

"Article of parent category" and "Article of child category" are displayed.

Request URL:
https://example.g.kuroco.app/rcms-api/13/news?contents_type%5B%5D=17&contents_type%5B%5D=54

Response body:

{
"errors": [],
"messages": [],
"list": [
{
"topics_id": 1152,
"ymd": "2023-02-16",
"contents_type": 17,
"contents": "",
"subject": "Article of parent category",
・
・
・
},
{
"topics_id": 1153,
"ymd": "2023-02-16",
"contents_type": 54,
"contents": "",
"subject": "Article of child category",
・
・
・
}
],
"pageInfo": {
"totalCnt": 2,
・
・
・
}
}

Narrowing down by category_parent_id​

Filtering by category_parent_id considers the parent-child relationships in content categories. Therefore, the list of content belonging to the specified content category and its subcategories is returned.

Filtering by category_parent_id=[17]​

"Article of parent category", "Article of child category", and "Article of grandchild category" are displayed.

Request URL:
https://example.g.kuroco.app/rcms-api/13/news?category_parent_id%5B%5D=17

Response body:

{
"errors": [],
"messages": [],
"list": [
{
"topics_id": 1152,
"ymd": "2023-02-16",
"contents_type": 17,
"contents": "",
"subject": "Article of parent category",
・
・
・
},
{
"topics_id": 1153,
"ymd": "2023-02-16",
"contents_type": 54,
"contents": "",
"subject": "Article of child category",
・
・
・
},
{
"topics_id": 1154,
"ymd": null,
"contents_type": 55,
"contents": "",
"subject": "Article of grandchild category",
・
・
・
}
],
"pageInfo": {
"totalCnt": 3,
・
・
・
}
}

Filtering by category_parent_id=[54]​

"Article of child category" and "Article of grandchild category" are displayed.

Request URL:
https://example.g.kuroco.app/rcms-api/13/news?category_parent_id%5B%5D=54

Response body:

{
"errors": [],
"messages": [],
"list": [
{
"topics_id": 1153,
"ymd": "2023-02-16",
"contents_type": 54,
"contents": "",
"subject": "Article of child category",
・
・
・
},
{
"topics_id": 1154,
"ymd": null,
"contents_type": 55,
"contents": "",
"subject": "Article of grandchild category",
・
・
・
}
],
"pageInfo": {
"totalCnt": 2,
・
・
・
}
}

Narrowing down by exclude_category_parent_id​

Using exclude_category_parent_id allows you to exclude the list of content belonging to the specified content category and its subcategories from the response.

Filtering by exclude_category_parent_id=[54]​

Only "Article of parent category" is displayed.

Request URL:
https://example.g.kuroco.app/rcms-api/13/news?exclude_category_parent_id%5B%5D=54

Response body:

{
"errors": [],
"messages": [],
"list": [
{
"topics_id": 1152,
"ymd": "2023-02-16",
"contents_type": 17,
"contents": "",
"subject": "Article of parent category",
・
・
・
}
],
"pageInfo": {
"totalCnt": 1,
・
・
・
}
}

Support

If you have any other questions, please contact us or check out Our Slack Community.