I have a sharepoint server 2016 like the one I show in the attached image.
I want, through a java code, to read the metadata of the document notes.txt
, but I do not know what url endpoint to use for it.
Can someone solve my doubt?
Thank you.
You can use the SharePoint REST API for files and folders to get the metadata (or content) of the file.
For your example, the server-relative endpoint URL would be:
The file with basic metadata:
/my/personal/KIEWB/_api/web/getfilebyserverrelativeurl('/my/personal/KIEWB/Documentos compartidos/notas.txt')
The file content:
/my/personal/KIEWB/_api/web/getfilebyserverrelativeurl('/my/personal/KIEWB/Documentos compartidos/notas.txt')/$value
The list item metadata for the file:
/my/personal/KIEWB/_api/web/getfilebyserverrelativeurl('/my/personal/KIEWB/Documentos compartidos/notas.txt')/ListItemAllFields
"IF-MATCH": "*"
. It seams to have to do with the ETag which is used to determine the sequence for and managing of concurrent updates. Providing a wildcard *
will ignore the ETag. Marc Anderson (SPServices author) wrote a blog post about that.