Forum Discussion
bma - try making this call as restadmin, moreover, when you use show_hidden param, it should include all of them. Though, we have noticed a bug with show_hidden param, After further research, We found that the issue is with the API itself. If the top level category is marked hidden in the community structure, then the api calls does not work as expected, even with the "show_hidden=false" or true parameter.
e.g. For the category in which all the nodes are hidden inside but the API is returning the results, whereas by default the API does not return the hidden areas in the response.
In this case, the category was marked hidden, hence API's were not working as expected, so we just made the parent category visible and everything inside it is hidden, and now it is working as expected.
so, try making ges to your parent category.
I hope this helps.
- bma10 years agoMentor
Hi Varun,
Thank you for your response!If I understand correctly, the current behavior in Lithium 15.6, is that the APIs /nodes/count, /nodes/nested/count returns different values depending on the category's hidden state (ignoring param show_hidden in either case).
I tried creating two categories (1 visible, 1 hidden) with two children respectively (1 visible, 1 hidden) and adding a text endpoint with contents:
<#assign count1 = restadmin("/categories/id/catA/nodes/count")/> <#assign count2 = restadmin("/categories/id/catA/nodes/count?show_hidden=true")/> <#assign count3 = restadmin("/categories/id/catA/nodes/count?show_hidden=false")/> <#assign count4 = restadmin("/categories/id/catB/nodes/count")/> <#assign count5 = restadmin("/categories/id/catB/nodes/count?show_hidden=true")/> <#assign count6 = restadmin("/categories/id/catB/nodes/count?show_hidden=false")/> /catA/nodes/count = ${count1.value} (expect 1) /catA/nodes/count (+hidden) = ${count2.value} (expect 2) /catA/nodes/count (-hidden) = ${count3.value} (expect 1) /catB/nodes/count = ${count4.value} (expect 1) /catB/nodes/count (+hidden) = ${count5.value} (expect 2) /catB/nodes/count (-hidden) = ${count6.value} (expect 1)
Which outputs:
/catA/nodes/count = 1 (expect 1) /catA/nodes/count (+hidden) = 1 (expect 2) /catA/nodes/count (-hidden) = 1 (expect 1) /catB/nodes/count = 2 (expect 1) /catB/nodes/count (+hidden) = 2 (expect 2) /catB/nodes/count (-hidden) = 2 (expect 1)
If I need a true count of all nodes in a category (that may or may not be hidden as well), do you recommend that I paginate through /nodes?show_hidden=true and then return the count manually?
Do you know if Lithium 15.7 will support show_hidden param for /count?
Related Content
- 2 years ago
- 3 years ago