> For the complete documentation index, see [llms.txt](https://ongrano.gitbook.io/ongrano-blog-pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ongrano.gitbook.io/ongrano-blog-pro/reference/api-reference/blog-categories.md).

# Blog Categories

{% hint style="info" %}
**Good to know:** This API document based on Shopware 6 default store-api. You can reach base introduction document via <https://shopware.stoplight.io/docs/store-api/38777d33d92dc-quick-start-guide> and request body; criteria and detail via <https://shopware.stoplight.io/docs/store-api/cf710bf73d0cd-search-queries>. This document gives us store api basics. Ongrano Blog Pro is designed based on these basics.&#x20;
{% endhint %}

## Category List

<mark style="color:green;">`POST`</mark> <https://your-site.com/store-api/blog-category>

return all categories regarding your criteria.&#x20;

#### Request Header

| Name                                            | Type   | Description         | Value                      |
| ----------------------------------------------- | ------ | ------------------- | -------------------------- |
| Accept<mark style="color:red;">\*</mark>        | string | Response type       | application/json           |
| Content-Type<mark style="color:red;">\*</mark>  | string | Request type        | application/json           |
| sw-access-key<mark style="color:red;">\*</mark> | string | Headless Access Key | SWSCQ1V1QJHHSKV0TFLYZ0LSD1 |

#### Request Body - Example Criteria 1

```json
{
    "limit": 5,
    "page": 1,
    "filter": [
        { "type": "equals", "field": "active", "value": true }
    ],
    "sort": [
        { "field": "name", "order": "ASC" }    
    ], 
    "includes": {
        "ongrano_blog_category": ["id", "name"]
    }
}
```

#### Request Body - Example Criteria 2

```json
{
    "limit": 10,
    "page": 1,
    "sort": [
        { "field": "name", "order": "DESC" }    
    ], 
    "includes": {
        "ongrano_blog_category": ["id", "name"]
    }
}
```

{% tabs %}
{% tab title="Response - Example Criteria 1" %}

```json
[
    {
        "versionId": "0fa91ce3e96a4bc2be4bd9ce752c3425",
        "translated": {
            "name": "test category 1",
            "customFields": {},
            "description": null,
            "metaTitle": "test category 1",
            "metaDescription": "test category 1",
            "keywords": "test category 1"
        },
        "createdAt": "2024-05-08T08:44:46.879+00:00",
        "updatedAt": null,
        "mediaId": "018f3e3c45e676ad8a4bb9d3707cfc47",
        "name": "test category 1",
        "active": true,
        "translations": null,
        "media": null,
        "metaTitle": "test category 1",
        "metaDescription": "test category 1",
        "keywords": "test category 1",
        "id": "018f5760679b714fbae0632757b5d804",
        "customFields": null,
        "description": null,
        "apiAlias": "ongrano_blog_category"
    },
    {
        "versionId": "0fa91ce3e96a4bc2be4bd9ce752c3425",
        "translated": {
            "name": "test category 2",
            "customFields": {},
            "description": null,
            "metaTitle": "test category 2",
            "metaDescription": "test category 2",
            "keywords": "test category 2"
        },
        "createdAt": "2024-05-03T11:34:50.161+00:00",
        "updatedAt": "2024-05-08T08:44:56.459+00:00",
        "mediaId": "018f3e3c45e676ad8a4bb9d3707cfc47",
        "name": "test category 2",
        "active": true,
        "translations": null,
        "media": null,
        "metaTitle": "test category 2",
        "metaDescription": "test category 2",
        "keywords": "test category 2",
        "id": "018f3e392d8373a6a02fe0a32c4c17c8",
        "customFields": null,
        "description": null,
        "apiAlias": "ongrano_blog_category"
    },
    {
        "versionId": "0fa91ce3e96a4bc2be4bd9ce752c3425",
        "translated": {
            "name": "test category 3",
            "customFields": {},
            "description": null,
            "metaTitle": "test category 3",
            "metaDescription": "test category 3",
            "keywords": "test category 3"
        },
        "createdAt": "2024-05-08T08:45:04.880+00:00",
        "updatedAt": "2024-05-08T08:45:17.193+00:00",
        "mediaId": "018f3e3c45e676ad8a4bb9d3707cfc47",
        "name": "test category 3",
        "active": true,
        "translations": null,
        "media": null,
        "metaTitle": "test category 3",
        "metaDescription": "test category 3",
        "keywords": "test category 3",
        "id": "018f5760adea7353a5b2c0ec675704bc",
        "customFields": null,
        "description": null,
        "apiAlias": "ongrano_blog_category"
    }
]
```

{% endtab %}

{% tab title="Response - Example Criteria 2" %}

```json
[
    {
        "name": "test category 4",
        "id": "018f5760eca0726e878366b96fa244bb",
        "apiAlias": "ongrano_blog_category"
    },
    {
        "name": "test category 3",
        "id": "018f5760adea7353a5b2c0ec675704bc",
        "apiAlias": "ongrano_blog_category"
    },
    {
        "name": "test category 2",
        "id": "018f3e392d8373a6a02fe0a32c4c17c8",
        "apiAlias": "ongrano_blog_category"
    },
    {
        "name": "test category 1",
        "id": "018f5760679b714fbae0632757b5d804",
        "apiAlias": "ongrano_blog_category"
    }
]
```

{% endtab %}
{% endtabs %}

## Category Detail

<mark style="color:green;">`POST`</mark> <https://your-site.com/store-api/blog-category/{blogCategoryId}>

return blog category regarding {blogCategoryId}

#### Request Header

<table><thead><tr><th width="171">Name</th><th width="81">Type</th><th>Description</th><th>Value</th></tr></thead><tbody><tr><td>Accept<mark style="color:red;">*</mark></td><td>string</td><td>Response type</td><td>application/json</td></tr><tr><td>Content-Type<mark style="color:red;">*</mark></td><td>string</td><td>Request type</td><td>application/json</td></tr><tr><td>sw-access-key<mark style="color:red;">*</mark></td><td>string</td><td>Headless Access Key</td><td>SWSCQ1V1QJHHSKV0TFLYZ0LSD1</td></tr></tbody></table>

#### Request Body - Example Criteria

```json
{
  "associations": {
    "media": {}
  },
  "includes": {
    "media": [
      "url"
    ]
  }
}
```

{% tabs %}
{% tab title="Response - Example Criteria" %}

```json
[
    {
        "versionId": "0fa91ce3e96a4bc2be4bd9ce752c3425",
        "translated": {
            "name": "test category 4",
            "customFields": {},
            "description": null,
            "metaTitle": "test category 4",
            "metaDescription": "test category 4",
            "keywords": "test category 4"
        },
        "createdAt": "2024-05-08T08:45:20.932+00:00",
        "updatedAt": "2024-05-08T08:45:31.255+00:00",
        "mediaId": "018f3e3c45e676ad8a4bb9d3707cfc47",
        "name": "test category 4",
        "active": false,
        "translations": null,
        "media": {
            "url": "http://127.0.0.1:8001/media/a7/34/8b/1714736088/plugin.png?1714736088",
            "apiAlias": "media"
        },
        "metaTitle": "test category 4",
        "metaDescription": "test category 4",
        "keywords": "test category 4",
        "id": "018f5760eca0726e878366b96fa244bb",
        "customFields": null,
        "description": null,
        "apiAlias": "ongrano_blog_category"
    }
]
```

{% endtab %}
{% endtabs %}
