Filtered response not show total records in response REST APIs Magento 2

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I am using GET V1/products endpoint to fetch product list. I want to fetch only sku and name only.



http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku]


response




"items": [

"sku": "5245",
"name": "Test Product"
,

"sku": "product 1",
"name": "product 1"
,

"sku": "product 2",
"name": "product 2"
,
]



I am not getting total number of records in this response. I checked it on devdocs as well. It also has same type of response, please find link below.



Magento filtered response



Please help if anyone already faced this and solved it.










share|improve this question





















  • sorry man but this link not helped me.
    – Ramkishan
    36 mins ago










  • which magento version you have? you may find issue here
    – Hit's
    32 mins ago











  • I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
    – Hit's
    24 mins ago










  • Thank you man, I found the solution and posted here.
    – Ramkishan
    24 mins ago
















up vote
1
down vote

favorite












I am using GET V1/products endpoint to fetch product list. I want to fetch only sku and name only.



http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku]


response




"items": [

"sku": "5245",
"name": "Test Product"
,

"sku": "product 1",
"name": "product 1"
,

"sku": "product 2",
"name": "product 2"
,
]



I am not getting total number of records in this response. I checked it on devdocs as well. It also has same type of response, please find link below.



Magento filtered response



Please help if anyone already faced this and solved it.










share|improve this question





















  • sorry man but this link not helped me.
    – Ramkishan
    36 mins ago










  • which magento version you have? you may find issue here
    – Hit's
    32 mins ago











  • I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
    – Hit's
    24 mins ago










  • Thank you man, I found the solution and posted here.
    – Ramkishan
    24 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am using GET V1/products endpoint to fetch product list. I want to fetch only sku and name only.



http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku]


response




"items": [

"sku": "5245",
"name": "Test Product"
,

"sku": "product 1",
"name": "product 1"
,

"sku": "product 2",
"name": "product 2"
,
]



I am not getting total number of records in this response. I checked it on devdocs as well. It also has same type of response, please find link below.



Magento filtered response



Please help if anyone already faced this and solved it.










share|improve this question













I am using GET V1/products endpoint to fetch product list. I want to fetch only sku and name only.



http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku]


response




"items": [

"sku": "5245",
"name": "Test Product"
,

"sku": "product 1",
"name": "product 1"
,

"sku": "product 2",
"name": "product 2"
,
]



I am not getting total number of records in this response. I checked it on devdocs as well. It also has same type of response, please find link below.



Magento filtered response



Please help if anyone already faced this and solved it.







magento2 rest-api search-criteria filtered-response






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 49 mins ago









Ramkishan

9481729




9481729











  • sorry man but this link not helped me.
    – Ramkishan
    36 mins ago










  • which magento version you have? you may find issue here
    – Hit's
    32 mins ago











  • I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
    – Hit's
    24 mins ago










  • Thank you man, I found the solution and posted here.
    – Ramkishan
    24 mins ago
















  • sorry man but this link not helped me.
    – Ramkishan
    36 mins ago










  • which magento version you have? you may find issue here
    – Hit's
    32 mins ago











  • I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
    – Hit's
    24 mins ago










  • Thank you man, I found the solution and posted here.
    – Ramkishan
    24 mins ago















sorry man but this link not helped me.
– Ramkishan
36 mins ago




sorry man but this link not helped me.
– Ramkishan
36 mins ago












which magento version you have? you may find issue here
– Hit's
32 mins ago





which magento version you have? you may find issue here
– Hit's
32 mins ago













I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
– Hit's
24 mins ago




I am getting total_count key in local(magento 2.2.6) which magento version you have? try magento225.sr/swagger#/catalogProductRepositoryV1/…
– Hit's
24 mins ago












Thank you man, I found the solution and posted here.
– Ramkishan
24 mins ago




Thank you man, I found the solution and posted here.
– Ramkishan
24 mins ago










2 Answers
2






active

oldest

votes

















up vote
1
down vote













Ok I found the solution, I checked some core files of catalog module and I can see that search criteria and total records are not comes in items so I just need to update my request.



http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku],total_count


I hope it'll help others, Happy Coding :)






share|improve this answer



























    up vote
    1
    down vote













    You need to select total count too to fetch it. Add total_count at the end of your request like this:



    REQUEST,total_count


    Hope this will help you.






    share|improve this answer








    New contributor




    Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

















    • Thanks Kamal, I already found the solution and your solution is same what I did :)
      – Ramkishan
      15 mins ago











    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f247278%2ffiltered-response-not-show-total-records-in-response-rest-apis-magento-2%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Ok I found the solution, I checked some core files of catalog module and I can see that search criteria and total records are not comes in items so I just need to update my request.



    http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku],total_count


    I hope it'll help others, Happy Coding :)






    share|improve this answer
























      up vote
      1
      down vote













      Ok I found the solution, I checked some core files of catalog module and I can see that search criteria and total records are not comes in items so I just need to update my request.



      http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku],total_count


      I hope it'll help others, Happy Coding :)






      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        Ok I found the solution, I checked some core files of catalog module and I can see that search criteria and total records are not comes in items so I just need to update my request.



        http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku],total_count


        I hope it'll help others, Happy Coding :)






        share|improve this answer












        Ok I found the solution, I checked some core files of catalog module and I can see that search criteria and total records are not comes in items so I just need to update my request.



        http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&currencyCode=USD&searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&fields=items[name,sku],total_count


        I hope it'll help others, Happy Coding :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 24 mins ago









        Ramkishan

        9481729




        9481729






















            up vote
            1
            down vote













            You need to select total count too to fetch it. Add total_count at the end of your request like this:



            REQUEST,total_count


            Hope this will help you.






            share|improve this answer








            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

















            • Thanks Kamal, I already found the solution and your solution is same what I did :)
              – Ramkishan
              15 mins ago















            up vote
            1
            down vote













            You need to select total count too to fetch it. Add total_count at the end of your request like this:



            REQUEST,total_count


            Hope this will help you.






            share|improve this answer








            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

















            • Thanks Kamal, I already found the solution and your solution is same what I did :)
              – Ramkishan
              15 mins ago













            up vote
            1
            down vote










            up vote
            1
            down vote









            You need to select total count too to fetch it. Add total_count at the end of your request like this:



            REQUEST,total_count


            Hope this will help you.






            share|improve this answer








            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            You need to select total count too to fetch it. Add total_count at the end of your request like this:



            REQUEST,total_count


            Hope this will help you.







            share|improve this answer








            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|improve this answer



            share|improve this answer






            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered 17 mins ago









            Kamal Paliwal

            111




            111




            New contributor




            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            Kamal Paliwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.











            • Thanks Kamal, I already found the solution and your solution is same what I did :)
              – Ramkishan
              15 mins ago

















            • Thanks Kamal, I already found the solution and your solution is same what I did :)
              – Ramkishan
              15 mins ago
















            Thanks Kamal, I already found the solution and your solution is same what I did :)
            – Ramkishan
            15 mins ago





            Thanks Kamal, I already found the solution and your solution is same what I did :)
            – Ramkishan
            15 mins ago


















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f247278%2ffiltered-response-not-show-total-records-in-response-rest-apis-magento-2%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke