How to get version history of a file in folder in sharepoint using SharePoint REST API using c#? - rest

I have a SharePoint library with a file in it. I need to get previous versions of the file who created it and when. What is the rest endpoint to fetch those details. I am new to SharePoint. Please help

You could use this rest endpoint to get previous versions of the file by the file id:
https://<server>/sites/<site>/_api/web/lists/getByTitle('Documents')/items(1)/versions
You could add filters at the end to get the information you need:
https://<server>/sites/<site>/_api/web/lists/getByTitle('Documents')/items(1)/versions?$select=VersionLabel,Created_x005f_x0020_x005f_By,Created

in order to get additional information from REST API request You need to use the $expand property. If You need information like who made the update please add '?$expand=CreatedBy' at the end of the request.. so for Your example it will be something like:
https:///sites//_api/web/GetFolderByServerRelativeUrl('Shared%20Documents/general')/files('SampleDocFile.docx')/versions?$expand=CreatedBy
that way You will have the user who modified the file in
content>properties>Title
other interesting data is:
updated>
content>properties>CheckInComment>
content>properties>VersionLabel>

Related

How to get an asset all details in AEM with API request?

I am using AEM API in my automation. We published a file from workfront to AEM. That file have multiple information:
1. Basic
2. Test1
3. test2
4. etc
When I hit the api:
/api/assets/..../abc.pdf.json
I am getting very less information under the properties and metadata section. (In short, it does not have Test1, Test2 and other tab information)
Is there any way to fetch all these from aem API's? It will reduce my overhead to validate these details from UI Automation.
First of look checkout the metadata nodes of file for the desired data to be present. I would rather prefer writing a custom servlet in AEM which takes in path parameter as an asset path and gives back the response back in desired format.
I figured it out.
The following API returns all the JCR content in API response:
<baseURL>/content/dam/path to that file.-1.json

How to: Get Report Definition using SSRS RESTful API?

I have been working with the RESTful SSRS endpoint documentation at https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0 and It states that I can retrieve the Report defintiion for my reports, however I cannot find any of the endpoints to do such?
From Microsoft docs:
The REST API can also be used to provide more advanced functionality,
such as:
Navigate the folder hierarchy Discover the contents of a folder
Download a report definition
Modify default report parameters Change
or execute a refresh plan A whole lot more
The REST API is a RESTful successor to the legacy SOAP API.
Maybe I am missing something?
I am able to get the Parameter Definitions, the report by ID,
however passing in any parameters such as
https://{myreportserver}/reports/api/v2.0/reports({id})?paramter1=somevalue
does not return any definition. I am trying to get a definition return so maybe I can render the report on a web application (or at minimum provide a pdf download of the report?)
Late to the game, but in case anyone else is looking for this answer, use this URL:
https://{myreportserver}/reports/api/v2.0/reports({id})?Content/$value

MS VSTS Rest API's: Get List of Attachments for a given item

Using the Azure API's, I am able to get the content of an attachment using:
GET https://dev.azure.com/fabrikam/_apis/wit/attachments/{id}?api-version=4.1
This assumes you know the guid (id) of the attachment you wish to download.
What I am trying to do is for a given workItem ID, get a list of ALL attachments (including the ID). Anyone know what the easiest way to achieve this is?
I find this Azure API may be helpful for you.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&api-version=4.1
For more details, you can refer to this doc.
Try $expand=Relations in the Api-Url
E.g. GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&$expand=Relations&api-version=4.1

ProjectServer 2013 REST API - Creating Tasks

I'm playing with ProjectOnline and trying to use REST APIs to create projects and tasks etc. I have managed to add a project using following REST call
https://<domain>.sharepoint.com/sites/pwa/_api/ProjectServer/Projects/Add
However when I try to add Task or a Resource to the created project it gives me error "Cannot find resource for the request Add". Could you please let me know what I'm doing wrong.
My REST call is this
https://<domain>.sharepoint.com/sites/pwa/_api/ProjectServer/Projects('<project ID>')/Tasks/Add
The project ID is the ID of the Project created using the REST call 1.
The problem appears to be that you are calling the PublishedProject resource add not the DraftProject resource, your URL needs to be something like this:
/_api/ProjectServer/Projects('projectid')/Draft/Tasks/add(parameters)
The Draft section being key here.
HTH,
Martin

How to Get Sharepoint data?

I have just started a Sharepoint, I would need items listed in Sharepoint 2013.
Please let me know is any rest service available to access data from sharepoint which I can store in my local db.
Please suggest me what are the best way to access data from it.
Thanks,
Laxmilal Menaria
In SharePoint 2013 the REST API Endpoints are different.
It's more like this:
/_api/lists/getByTitle('Custom List')/Items
You can use the REST interface.
http://msdn.microsoft.com/en-in/library/ff798339.aspx
For example:
http://localhost/_vti_bin/listdata.svc/Parts(3)
The preceding URL returns the Parts list item with an ID value of 3 as an Atom feed.