# How to find Shopware 6 total record count for a list endpoint

**URL:** <https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578>\
**Category:** Incoming Configuration\
**Created:** [May 5, 2023, 10:42am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578 "2023-05-05T10:42:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 5, 2023, 10:42am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/1 "2023-05-05T10:42:47Z")

</div>

I have set up an incoming configuration for Product Manufactures from Shopware 6 (using the list endpoint …/api/product-manufacturer). I have set up pagination for this and all works fine. Only, how or where can I see the total of Manufacturers in there, as a total number or number of pages given my limit? This would be needed to estimate scheduling as to how often and how many at a time we should run through, and to know the job is done before I start to run through the products in the same manner. Grateful for any answers!

Edit: I found [Shopware documentation](https://shopware.stoplight.io/docs/admin-api/ZG9jOjEyMzAzNDU1-request-and-response-structure) which shows that **meta.total** key should have that value, but in the data I have got in my Alumio response that value is just the total of records in the page.

---

<div class="post-metadata">

**Author:** ![jesse](https://forum.alumio.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jesse](https://forum.alumio.com/u/jesse)\
**Post date:** [May 8, 2023, 7:09am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/2 "2023-05-08T07:09:48Z")

</div>

Hi Kjetil,

I believe that Shopware provides you with a _links_ object. This object should contain the a link to the next, previous, first and last page. You can use the _Follow pagination_ functionality of the HTTP subscriber to let Alumio automatically retrieve subsequent pages.

Assuming you don’t have too many product manufacturers, you could let Alumio pull all pages with each execution.

 ![Screenshot 2023-05-08 at 09.09.08](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/77622da8a08805ce4cfaa4917fba1ecff2e35067.png)

---

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 8, 2023, 9:48am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/3 "2023-05-08T09:48:34Z")

</div>

Yes, there is a links object as well. But as with the meta.total the links.last is not in there. I will try and see if there is something to be configured on the Shopware side. The Manufacturers are not som many, but products are - and there is the same case.  
I tried for the sake of testing to pull all manufacturers in one go without pagination but that resulted in a timeout or resource error.

---

<div class="post-metadata">

**Author:** ![jesse](https://forum.alumio.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jesse](https://forum.alumio.com/u/jesse)\
**Post date:** [May 8, 2023, 9:50am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/4 "2023-05-08T09:50:26Z")

</div>

@kjetil can you share your request & response?

---

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 8, 2023, 10:00am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/5 "2023-05-08T10:00:21Z")

</div>

> Blockquote ```  
> {  
> “data”: [  
> {  
> “id”: “00695776de3b488b81537f00192e0b2f”,  
> “type”: “product\_manufacturer”,  
> “attributes”: {  
> “versionId”: “0fa91ce3e96a4bc2be4bd9ce752c3425”,  
> “mediaId”: null,  
> “link”: “”,  
> “name”: “To-Go Ware”,  
> “description”: “”,  
> “customFields”: null,  
> “createdAt”: “2023-01-07T16:38:05.000+00:00”,  
> “updatedAt”: “2023-01-07T16:38:05.000+00:00”,  
> “translated”: {  
> “name”: “To-Go Ware”,  
> “description”: “”,  
> “customFields”: {}  
> },  
> “apiAlias”: null  
> },  
> “links”: {  
> “self”: “…/api/product-manufacturer/00695776de3b488b81537f00192e0b2f”  
> },  
> “relationships”: {  
> “media”: {  
> “data”: null,  
> “links”: {  
> “related”: “…/api/product-manufacturer/00695776de3b488b81537f00192e0b2f/media”  
> }  
> },  
> “products”: {  
> “data”: ,  
> “links”: {  
> “related”: “…/api/product-manufacturer/00695776de3b488b81537f00192e0b2f/products”  
> }  
> },  
> “translations”: {  
> “data”: ,  
> “links”: {  
> “related”: “…/api/product-manufacturer/00695776de3b488b81537f00192e0b2f/translations”  
> }  
> }  
> },  
> “meta”: null  
> }  
> ],  
> “included”: ,  
> “links”: {  
> “first”: “…/api/product-manufacturer?limit=1&page=1”,  
> “next”: “…/api/product-manufacturer?limit=1&page=2”,  
> “self”: “…/api/product-manufacturer?limit=1”  
> },  
> “meta”: {  
> “totalCountMode”: 0,  
> “total”: 1  
> },  
> “aggregations”:   
> }

```auto

for request: GET /api/product-manufacturer?limit=1 HTTP/1.1
```

---

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 8, 2023, 10:16am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/6 "2023-05-08T10:16:08Z")

</div>

I just found the solution for getting the total (in this thread: [Paging not working correctly through @shopware-pwa/shopware-6-client (or REST) · Issue #2313 · shopware/platform · GitHub](https://github.com/shopware/platform/issues/2313)). [Shopware doc here](https://github.com/shopware/platform/issues/2313).

For Shopware it’s needed to add the **total-count-mode 1** in the query object of the request:  
{  
“path”: ,  
“query”: {  
“limit”: 1,  
“total-count-mode”: 1  
},  
“payload”:   
}

Now the response include this:

```auto
  "links": {
    "first": ".../api/product-manufacturer?limit=1&total-count-mode=1&page=1",
    "last": ".../api/product-manufacturer?limit=1&total-count-mode=1&page=264",
    "next": ".../api/product-manufacturer?limit=1&total-count-mode=1&page=2",
    "self": ".../api/product-manufacturer?limit=1&total-count-mode=1"
  },
  "meta": {
    "totalCountMode": 1,
    "total": 264
  },

```

---

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 8, 2023, 10:24am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/7 "2023-05-08T10:24:06Z")

</div>

Now I would like to add that total-count to the Pagination Storage I have for this Incoming request - or maybe to its own storage.

---

<div class="post-metadata">

**Author:** ![jesse](https://forum.alumio.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jesse](https://forum.alumio.com/u/jesse)\
**Post date:** [May 9, 2023, 9:38am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/8 "2023-05-09T09:38:07Z")

</div>

@kjetil you can use the ‘Save entity to storage’ transformer on the incoming configuration to store the _meta.total_ field to the storage. Then you can use the ‘Input transformer’ on the incoming configuration with the _Get an entity from storage_ transformer to retrieve said value for the next request.

---

<div class="post-metadata">

**Author:** ![kjetil](https://forum.alumio.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@kjetil](https://forum.alumio.com/u/kjetil)\
**Post date:** [May 9, 2023, 9:58am UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/9 "2023-05-09T09:58:00Z")

</div>

I made such a transformer but unfortunately it did not work out. The response in the incoming is boiled down {“meta”:{}, “data”:} . The data object is an array containing the items. Applied pagination and said ‘data’ to be the items (stored in storage and later sent to outgoing). In the end of the incoming config (after pagination) I added the save entity to storage for meta and links object. BUT at that point the entity seems to no more include what’s outside of the data object. I only get links and meta object that are inside data object.  
When I run the test on the full response I get the expected objects stored to storage. But I don’t see a place to put this transformer before the item entity “clipping” is done. However this is not a show-stopper. I probably don’t need to bother about the totals in advance (just me like to know I got all there was). And I guess one workaround would be to make a separate call (Incoming) with limit 1, page 1 and don’t process for items just to get the total and store that without any outgoing.

---

<div class="post-metadata">

**Author:** ![jesse](https://forum.alumio.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jesse](https://forum.alumio.com/u/jesse)\
**Post date:** [May 9, 2023, 12:06pm UTC](https://forum.alumio.com/t/how-to-find-shopware-6-total-record-count-for-a-list-endpoint/578/10 "2023-05-09T12:06:40Z")

</div>

@kjetil if you use the _pagination_ option on the HTTP subscriber it will indeed change to scope to the underlying items. This means you are indeed unable to access the _meta_ key on the root. For now there you’ll need to rely on workarounds in case you want to store it.
