First of all, I do not think you have to use the old
_vti_bin / listdata.svc in conjunction with the new REST API, your URL should simply be:
.sharepoint.com / sites / FieldManagement / _api / lists / getbytitle (% 27Merchandiser% 20Inspection% 27) / items? $ select = AttachmentsItem / ServerRequestUrl & $ expand = Attachments
Second, to get the information on the attachments, I do not know if it is possible to expand the attachment information for all articles at the same time. I just tried a bunch of tests in Postman, and none of the queries where I tried to
$ select and
$ expand on the
AttachmentFiles property worked, they usually returned the error
The value is not in the expected range.
You can get the attachment information for a single item, like this:
.sharepoint.com / sites / FieldManagement / _api / lists / getbytitle (% 27Merchandiser% 20Inspection% 27) / items / getbyid (41) / AttachmentFiles
To get the information for all items, it can be a two-step process because can make
.sharepoint.com / sites / FieldManagement / _api / lists / getbytitle (% 27Merchandiser% 20Inspection% 27) / items? $ select = AttachmentFiles
$ expand) who, if you define your
accept at the head of
application / json; odata = verbose to retrieve JSON instead of XML, will return an array of simple JSON objects with the
AttachmentFiles property for each of the items in the list, and in this
AttachmentFiles property you will find
AttachmentFiles .__ reported.uri
which is a URL about the same as the one I mentioned above to get the attachment information for a single item, with the
getbyid (x) already set to the correct list item ID.
I am not used to working with SP REST services returning XML, so I do not know exactly how it would be formatted if you needed it in XML.
Nevertheless, this two-step process can work because you do not need to know the list item IDs to create the first query to get the result.
AttachmentFiles property for all list items, and once you get that, you do not need to know the item IDs of the list because it's already coded in the
AttachmentFiles .__ deferrred.uri value.
I just did a quick test without the
accept header, and this secondary URL is returned in a slightly different format:
When obtaining a JSON response, the
__deferred.uri value is an absolute URL that you can simply return and connect directly to another query.