1

I can get a specific page by exact url using ApiClient:

ApiClient client = ApiClientFactory.Instance.CreateClient();
...
var page = client.GetPage(ContentNamespace.Sites, publicationId, pageUrl, null, ContentIncludeMode.IncludeJsonAndRender, null);

or list of pages (also with exact url):

var pages = client.GetPages(ContentNamespace.Sites, new Pagination { First = 10, After = null }, pageUrl, null, ContentIncludeMode.IncludeJsonAndRender, null);

Is there a way to get all published pages in a given structure group using graphql api (ApiClient)?

4

So assuming your publishing your Structure Group information then this should be stored in the TAXFACETS table alongside other taxonomy information (categories and keywords).

The following works:

var filter = new InputItemFilter();
filter.ItemTypes = new List<FilterItemType>() { FilterItemType.PAGE };
filter.PublicationIds = new List<int?>() { 5 };
filter.Keyword = new InputKeywordCriteria() {
    CategoryId = 89,
    KeywordId = 89
};

client.ExecuteItemQuery(filter, null, null, null, ContentIncludeMode.Exclude, true, null)

Note that CategoryId and KeywordId are the same Structure Group item id - this is because each Structure Group is stored as its own taxonomy in the TAXFACETS table, unlike keywords, whose taxonomy Id would be that of the category.

5
  • Always wondered how the publish SG information works. Good stuff Neil
    – Atila Sos
    Jul 6 at 13:52
  • Thank you very much Neil. It's working like a charm! Exactly what I need. I'm wondering how did you figure that out? Jul 6 at 22:48
  • Played with the GraphiQL environment first, then took a look in the TAXFACETS table at the information it was storing when you publish a Structure Group.
    – Neil
    Jul 7 at 10:06
  • Note that the ApiClient your using is not up to date with regards to the latest Public Content API features such as search. As it is open source there are no current plans to update it either. You maybe better using a different .NET GraphQL client and executing a raw GraphQL query with it instead.
    – Neil
    Jul 7 at 10:10
  • I should consider that. Thanks Neil for the very useful information. Jul 7 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.