Access SharePoint Online Data Using Postman Part 2
WebSiteAdmin, March 11, 20224985 Views
Now, in this blog we will see how to access SharePoint online data.
In this example, we will resize SharePoint Online image by using the Microsoft Graph API via SharePoint using the /_api/v2.0.
We need to specify the size; large, small, and medium; in the request URL to resize the image that would give us the result in the fixed predefined resolutions.
The URL looks like below:
https://test.sharepoint.com/_api/v2.0/sharePoint:/sites/Test/SiteAssets/SitePages/About-us/test.JPG:/driveItem/thumbnails/0/large/content
Generally, we have a common default site for all environments than you can call API as below:
https://test.sharepoint.com/_api/v2.0/sharePoint:/account/_D56E4DF74E214024BD4B0E48DFE3107C/cricket.PNG:/driveItem/thumbnails/0/large/content
Above example is for the Common default site, however, if we have different SharePoint Sites for different Environments, we can call the API as below:
https://test.sharepoint.com/_api/v2.0/sharePoint:/sites/Test/account/_D56E4DF74E214024BD4B0E48DFE3107C/cricket.PNG:/driveItem/thumbnails/0/large/content
The fixed sizes clause (Large, small, medium) can be replaced by custom size (it could be anything in pixels) with the following format /c1920x1080 where the number after the c is the width and the number after x is the height. Please see below example.
https://test.sharepoint.com/_api/v2.0/sharePoint:/account/_D56E4DF74E214024BD4B0E48DFE3107C/cricket.PNG:/driveItem/thumbnails/0/ c1920x1080/content
Now, it’s time to access the above API using postman and resize SharePoint Online image.
- To do this, we need to put this below URL in Postman URL:
https://test.sharepoint.com/_api/v2.0/sharePoint:/account/_D56E4DF74E214024BD4B0E48DFE3107C/cricket.PNG:/driveItem/thumbnails/0/large/content
- Select the request as a GET method.
- In Header, apply configuration parameter as below.
- Accept: application/json;odata=verbose
- Authorization: Bearer [value of access_token]
The “access_token” value, is what we got from the previous part of this blog.
https://www.inkeysolutions.com/blogs/access-sharepoint-online-data-part-1/
Now, we can use this ”access_token” value in the header configuration parameter as the “Authorization” value.
Note: that there is a space in between Bearer and Access token value.
After the following previous steps correctly in Postman, it would show as below image.
- Then click the “Send” button as shown in the above image. You would get a status “200 OK” which means API calling is successfull and the result of resized image would be displayed in the body. (Refer below image)
If you are using this API via code then resized image value would be a Byte array than you can use for further process.
Hope this helps!
ATM Inspection PowerApp to ease ATM inspection and report generation process.
https://www.inkeysolutions.com/microsoft-power-platform/power-app/atm-inspection
Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox
Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr
Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator