I am trying to retrieve Images using the REST API from iOS/Android.
The issue I’m running into is when the images are stored in the /sites/siteName directory, the REST call does not work. Let me explain further:
My REST call: //tenant/_api/web/GetFileByServerRelativeUrl('/sites/siteName/PublishingImages/image.jpg')/$value
- That call does not work. I get a
Microsoft.SharePoint.SPException
- The file/sites/siteName/PublishingImages/image.jpg
does not exist. - The file does indeed exist because inside the web browser I can view the image using:
//tenant.com/sites/siteName/PublishingImages/image.jpg
The REST call that does work is:
//tenant.com/_api/web/GetFileByServerRelativeUrl
('/News/PublishingImages/image.jpg')/$value
- That returns the image as expected.
I’m not a SharePoint developer so my knowledge is very light. But, I’m confused to as why those calls do not work.
Any help is very appreciated.
Thanks