3

I am using the following url to get a file based on the ID in the list:

https://<site>/_api/web/lists/getbyTitle('<library>')/items(itemId)/

I am getting data back, but I need the properties of this item that are returned from a search, especially the ServerRedirectEmbedURL, ServerRedirectPreviewURL, and the ServerDirectedURL as well as the Path so I can download this file. The library and itemId are coming from a local database and I am stuffing them into the url and doing a get. I get a response and can see the JSON returned, but I am not seeing the fields I would need in a search. I am using the right call here or do I need another call to get this data? This is all so mysterious so I do appreciate all the help I am getting.

john
  • 235
  • 2
  • 12

1 Answers1

3

I struggled with this for a while, but eventually found that you need to add ?$expand=fileto the query string URL, e.g https://<site>/_api/web/lists/getbyTitle('<library>')/items(itemId)/?$expand=file

This will then include a File object in the JSON response containing the goodies you are after.

Fairfield
  • 612
  • 11
  • 20
  • I added this to the end of the line and sent it to the server. I got a response but I didn't see anywhere in the response where the ServerRedirectEmbedURL, ServerRedirectPreviewURL, ServerDirectedURL, and Path were located in the JSON response. I get some additional fields, but not these fields. I'll keep digging and if I find something post it here. – john Jul 25 '18 at 15:04