Logo
banner

Blogs

Access SharePoint Online Data Using Postman Part 2

, March 11, 2022 239 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

mm

Inkey

INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

One response to “Access SharePoint Online Data Using Postman Part 2”

  1. […] Access SharePoint Online Data Using Postman Part 2 […]

Leave a Reply

Your email address will not be published.

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here