Graph API testing with SharePoint
Tools like Powershell or Postman will support making Graph API requests. You can also use plugins to VS Code for quick testing and pulling of data. REST Client for VS Code has > 6 million downloads and is easy to use for quick tests.
@tenantId =
@clientId =
@clientSecret =
@baseUri = https://graph.microsoft.com
@scope = {{baseUri}}/.default
@url = {{baseUri}}/v1.0
### Authenticate
# @name auth
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1
Content-type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id={{clientId}}
&client_secret={{clientSecret}}
&scope={{scope}}
### Variable Response
@accessHeader = Bearer {{auth.response.body.$.access_token}}
### List sites
# @name GetSites
GET {{url}}/sites/ HTTP/1.1
Authorization: {{accessHeader}}
### Reference a specific site by name
# @name GetSiteByName
GET {{url}}/sites/xxx.sharepoint.com:/sites/SoundCoast HTTP/1.1
Authorization: {{accessHeader}}
### Get drives for a site - replace <site id> with a valid ID from the previous request
# @name GetDrives
GET {{url}}/sites/<site id>/drives HTTP/1.1
Authorization: {{accessHeader}}
### Get folders for a drive - replace <site id>
# @name GetFolders
GET {{url}}/sites/<site id>/root/children?$filter=folder ne null HTTP/1.1
Authorization: {{accessHeader}}
### Get item by name
# @name GetItem
GET {{url}}/sites/<site id>/drives/<drive id>/root:/Invoices2026/WBMason_Pencils.pdf HTTP/1.1
Authorization: {{accessHeader}}