SOLVED

How to get all pages under "sitePages" using SharePoint REST API in modern sites ?

%3CLINGO-SUB%20id%3D%22lingo-sub-356478%22%20slang%3D%22en-US%22%3EHow%20to%20get%20all%20pages%20under%20%22sitePages%22%20using%20SharePoint%20REST%20API%20in%20modern%20sites%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-356478%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20created%20number%20of%20pages%20under%20%22%2FSitePages%22%20and%20want%20to%20retrieve%20them%20using%20SharePoint%20REST%20API.%3C%2FP%3E%3CP%3EThe%20below%20one's%20doesn't%20work%3C%2FP%3E%3CP%3E_api%2Fweb%2Flists%2Fgetbytitle('SitePages')%2FItems%3C%2FP%3E%3CP%3E_api%2Fweb%2Flists%2Fgetbytitle('Pages')%2FItems%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-356478%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EREST%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20REST%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-356544%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20all%20pages%20under%20%22sitePages%22%20using%20SharePoint%20REST%20API%20in%20modern%20sites%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-356544%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3E_api%2Fweb%2Flists%2Fgetbytitle('Site%20Pages')%2FItems%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EWith%20a%20space%20as%20its%20looking%20for%20the%20Title%20not%20url%20%3A)%3C%2Fimg%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ECheers%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-356542%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20all%20pages%20under%20%22sitePages%22%20using%20SharePoint%20REST%20API%20in%20modern%20sites%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-356542%22%20slang%3D%22en-US%22%3E%3CP%3EGot%20It%20--%20Resolved%20--%3C%2FP%3E%3CP%3E%2F_api%2FWeb%2FLists(guid'SomeGUID')%3C%2FP%3E%3CP%3E%2F_api%2FWeb%2FLists(guid'SomeGUID')%2FItems(19)%3F%24select%3DID%2CTitle%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1811171%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20all%20pages%20under%20%22sitePages%22%20using%20SharePoint%20REST%20API%20in%20modern%20sites%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1811171%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F149964%22%20target%3D%22_blank%22%3E%40Tarundeep%20Singh%3C%2FA%3E%26nbsp%3BCan%20you%20please%20elaborate%20little%20bit%3C%2FP%3E%3CP%3EI'm%20still%20couldn't%20get%20it%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1812174%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20all%20pages%20under%20%22sitePages%22%20using%20SharePoint%20REST%20API%20in%20modern%20sites%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1812174%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F843222%22%20target%3D%22_blank%22%3E%40Kumar0001%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22lia-spoiler-container%22%3E%3CA%20class%3D%22lia-spoiler-link%22%20href%3D%22%23%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ESpoiler%3C%2FA%3E%3CNOSCRIPT%3E(Highlight%20to%20read)%3C%2FNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-border%22%3E%3CDIV%20class%3D%22lia-spoiler-content%22%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3Ehere%20is%20my%20function%20for%20this%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSayannara%2FSPO%2Fblob%2Fmaster%2FGet-SPSitePagesContent.ps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSayannara%2FSPO%2Fblob%2Fmaster%2FGet-SPSitePagesContent.ps1%3C%2FA%3E%3C%2FDIV%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-noscript-container%22%3E%3CDIV%20class%3D%22lia-spoiler-noscript-content%22%3EHello%2Chere%20is%20my%20function%20for%20thishttps%3A%2F%2Fgithub.com%2FSayannara%2FSPO%2Fblob%2Fmaster%2FGet-SPSitePagesContent.ps1%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FNOSCRIPT%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I have created number of pages under "/SitePages" and want to retrieve them using SharePoint REST API.

The below one's doesn't work

_api/web/lists/getbytitle('SitePages')/Items

_api/web/lists/getbytitle('Pages')/Items

 

4 Replies
Best Response confirmed by Tarundeep Singh (Occasional Contributor)
Solution

Got It -- Resolved --

/_api/Web/Lists(guid'SomeGUID')

/_api/Web/Lists(guid'SomeGUID')/Items(19)?$select=ID,Title

_api/web/lists/getbytitle('Site Pages')/Items

 

With a space as its looking for the Title not url :)

 

Cheers

@Tarundeep Singh Can you please elaborate little bit

I'm still couldn't get it

@Kumar0001 

Spoiler