I am on SharePoint Online environment, where i have a site(Lets call it Site A) https://xxxxx.com/sites/sitecollection/SiteA and multiple sub sites under Site A (Subsite B, Subsite C, Subsite D and so on....). The subsites are added every month and there is no specific number. https://xxxxx.com/sites/sitecollection/SiteA/SubsiteB(same thing goes with C,D,... ). So this is the hierarchy.
All the sites (Site A, Subsite B, Subsite C, Subsite D.....) have lists (List A, List B, List C, List D,....)respectively that are tagged with a unique Content Type, Lets Call it Content Type X.(I have created this content type, not a system generated one). What i mean is (Content type of List A, B, C and D..... are same, but the data is unique).
I am trying to pull all the list items under List A, List B, List C and List D and ....(that are tagged with this Content Type X) using Rest API.
If its just one list, you can use this "/_api/web/lists/getbytitle('List A')/items?$select=Title,URL,ContentType/Name&$expand=ContentType&$filter=ContentType eq 'Content Type X'".
But the challenging part is, I want to pull all list items from the List A, List B, List C,..... dynamically
Any suggestions will be helpful.