In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (2024)

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (1)

Access SharePoint Online data using postman tool – today in this article we will learn about accessing SharePoint data using the postman tool and SharePoint REST API. Before that, we should have a basic understanding of SharePoint REST API, the use of the REST API in SharePoint, and HTTP operation in SharePoint using REST API. In my previous article, I have written on this Basic understanding of REST API in SharePoint online – CRUD Operations – so you may go thru this before following this. Then we should have basic knowledge about what is postman tool and why should I use It. How to use postman to manage and execute your APIs.

Before getting into this article, you may also want to read this: The Ultimate Postman Tutorial: A Beginner’s Guide to REST API Testing

Table of Contents

Table of Contents – Access SharePoint Online data using postman tool:

  • What is the postman tool?
  • What is the use of the Postman tool?
  • Download postman for windows – where can we download the postman tool?
  • Authentication Policies – SharePoint online
  • Authorize Postman to access SharePoint
  • Register Add-In – SharePoint online
  • Grant Permissions to Add-In – SharePoint online
  • Add-in permissions in SharePoint – App permission
  • Differences between add-in permission rights and user rights
  • Retrieve the Tenant ID in the Postman tool
  • Generate access token – how to generate an access token in postman?
  • Access SharePoint Online using Postman
  • Generate code snippet in postman
  • Generated code for C# – RestSharp – GET operation
  • Generated code for HTTP – GET operation
  • SharePoint API -create a new item in the list using Postman
  • Add a new item to SharePoint online list using the postman tool – verification
  • Generated code for C# – RestSharp – POST operation:
  • Generated code for HTTP – POST operation

What is the postman tool – access sharepoint online data using postman tool?

The postman is a Google Chrome app for interacting with HTTP APIs. It provides a friendly GUI for constructing requests and reading responses.

The Postman is currently one of the most popular tools used in API testing. The use of the postman started in 2012 – the purpose of the postman was to simplify API workflow in testing and development. This works based on the REST API foundation – API stands for Application Programming Interface which allows software applications to communicate with each other via API calls.

We can send requests in Postman to connect to APIs you are working with like SharePoint’s inbuilt REST API. The REST API requests can retrieve, add, delete, and update data. The REST API requests can send parameters, authorization details, and anybody data you require.

When you send a request, the postman will display the response received from the API server in a way that lets you examine, visualize, and if necessary troubleshoot it.

What is the use of the Postman tool?

Postman tool is one of the most popular REST API testing tools available in the market – over 4 million users use postman nowadays. Why do people use this? Because of the below features people around the world use this.

  • A quick test of REST API
  • Generate Code Snippets
  • Accessibility
  • Use of Collections
  • Collaboration
  • Creating Environments
  • Creation of Tests
  • Automation Testing
  • Debugging
  • Continuous Integration

However, from the above list, I personally like the most top-two “Quick test of REST API” and “Generate Code Snippets” features.

Using “Quick test of REST API” we can quickly perform the testing of any REST API thru the UI rather than writing some coding. Example SharePoint REST API to GET or POST items.

On successful API testing, similarly using the Generate Code Snippets” feature we can generate the outbox of the equivalent coding in almost all languages like C#, C, Java, PowerShell, etc. And the generated API code we can directly use in our actual project is the awesomeness of postman which really speedups up the development work.

Download postman for windows – where can we download the postman tool?

The postman tool can be downloaded from this link – Get Postman for Windows.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (2)

Get Postman for Windows – Download Postman

The main agenda of this article is how to get connected with SharePoint online and do the GET and POST operations with its resources.

So in order to get this done – we need to know about “Authentication Policies” and “Request Headers” – which we will be using frequently over time in this article.

Authentication Policies – SharePoint online:

We can use any of the below policies to authenticate the Add-In – in SharePoint online.

  • User Policy
  • Add-In Policy – We are using this policy to authenticate the external system to
  • Access SharePoint
  • User +Add-In Policy

Request Headers:

We need to have the value of the below keys:

  • Client Id – will get it from the SharePoint online page.
  • Client Secret – will get it from the SharePoint online page.
  • Realm (Tenant Id) – will get it from the postman tool.
  • Access Token – will get it from the postman tool.

Authorize Postman to access SharePoint

To get authorization from the external system, we should pass the access-token value as a request header along with the REST API URL. Before that we need to have the “access_token” – for that, we should generate “Client Id” and “Client Secret” information from the particular SharePoint site by registering as an “App only Add-In” in a SharePoint site.

Authorize Postman to access SharePoint – in high-level steps are as below:

1. Register Add-In
2. Grant Permissions to Add-In
3. Generate the Access Token
4. Access the SharePoint resource

Here I will explain how to “Register Add-In“, “Grant Permissions to Add-In” in SharePoint online and how to get the “Tenant Id”, “Access Token” and data from SharePoint using the Postman tool.

https://YourSharePointOnlineSiteURL/_api/web?$select=Title

Step #1:

Register Add-In – SharePoint online:

Go to the “appregnew.aspx” page in SharePoint online site where you want to connect.

Syntax:

https://YourSharePointOnlineSiteUrl/_layouts/15/appregnew.aspx

Example:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_layouts/15/appregnew.aspx

Click on the “Generate” “Client Id” button and “Client secret” button. And enter below details as like the screenshot:

  • Title – any meaningful text.
  • App Domain – localhost
  • Redirect URI – https://localhost

Then click on the “Create” button.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (3)

After clicking on the “Create” button we will land on the below page:

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (4)

Note down the above text in notepad then click on the “Ok” button. For example here is my saved “Client Id” and client Secret details:

The app identifier has been successfully created.

Client Id:97145705-6a29-489a-a577-5a6838efdaed
Client Secret:ANSe8BFLPOo6oS5TrEzZB320Gz4qhMp+t06Ia+AGINk=
Title:Postman to SharePoint AddIn
App Domain:localhost
Redirect URI:https://localhost

Step #2:

Grant Permissions to Add-In – SharePoint online:

Go to the “appinv.aspx” page of the same SharePoint online site.
Syntax:

https://YourSharePointOnlineSiteUrl/_layouts/15/appinv.aspx


Example:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_layouts/15/appinv.aspx

Enter the “Client Id” in the “App Id” box which we have received in the previous step and click on the “Lookup” button as below:

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (5)

Enter the below XML in the “Permission Request XML” box and click on the “Create” button.

<AppPermissionRequests AllowAppOnlyPolicy="true"><AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (6)

Then we will land on the below page.

Do you trust Postman to SharePoint AddIn?

  • Let it have full control of this site.
  • Let it share its permissions with other users.
  • Let it access basic information about the users of this site.

Click on the “Trust It” button.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (7)

That’s it, app permission registration is done!!!

Add-in permissions in SharePoint – App permission:

Below are the various “Add-in permissions in SharePoint – App permission” that are available: SharePoint add-in permission request scope URIs and descriptions.

ScopeScope URIDescription
Tenancyhttp://sharepoint/content/tenantThe tenancy where the add-in is installed. Includes all children of this scope.
Site Collectionhttp://sharepoint/content/sitecollectionThe site collection where the add-in is installed. Includes all children of this scope.
Websitehttp://sharepoint/content/sitecollection/webThe website where the add-in is installed. Includes all children of this scope.
Listhttp://sharepoint/content/sitecollection/web/listA single list on the website where the add-in is installed.

Tenancy Scope – Description:

The tenancy where the add-in is installed. Includes all children of this scope.

Site Collection Scope – Description:

The site collection where the add-in is installed. Includes all children of this scope.

Website Scope – Description:

The website where the add-in is installed. Includes all children of this scope.

ListScope – Description:

If the add-in needs permission to more than one list, it must request permission to web scope.

Also, since you, the developer, have no way to control which list the user chooses or to tell the user which one to choose, you must use web scope if there is a list to which your add-in must have permission (but there is a way to narrow the user’s choice to certain subsets of lists; below see Permission request scope with associated properties.)

Differences between add-in permission rights and user rights

Permissions indicate the activities that an add-in is permitted to do within the requested scope. SharePoint supports four rights levels in the content database. For each scope, an add-in can have the following rights:

  • Read
  • Write
  • Manage
  • FullControl

Step #3:

Retrieve the Tenant ID in the Postman tool:

We have got the “Client Id” and “Client Secret”, now we need to retrieve the Tenant ID from SharePoint online tenant using the Postman tool. To do that let’s follow the below steps:

  • Launch Postman chrome extension.
  • Select GET Method
  • Enter the below URL in the “Request URL” textbox
    https://YourSPOSiteURL/_vti_bin/client.svc/
  • Configure the below information in the header section to send along with the url request Method = GET

Headers:

KeySyntaxValue
AuthorizationBearerBearer
https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_vti_bin/client.svc/
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (8)

Click on the “Send” button.

After applying the configuration, click on the Send button. The response returns a lot of headers however, it ends with unauthorized access. To avoid this access issue we need to generate the access token. In the below steps, we will see how to generate an access token.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (9)

Step #4:

Generate access token – how to generate an access token in postman?

In this step, we will learn how to generate an access token in the postman. In the response header, we will get WWW-Authenticate as one of the headers as highlighted below, for that key on the right side, we can see the realm value which is nothing but the tenant id for the SharePoint Online site and “client_id” value contains the resource information – these two highlighted value we need use later in this article. So we need to note down the below:

realm=”63cbe529-197e-4e1a-8492-f500e7174ee0″ = SharePoint Online Tenant Id

client_id=”00000003-0000-0ff1-ce00-000000000000″ = Resource information value, it is common for all.

To locate the above navigation we need to follow the below

Headers (Tab) thenWWW-Authenticate as highlighted below:

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (10)

After getting the “Tenant ID“, we need to form an URL in the below format:

Syntax:

https://accounts.accesscontrol.windows.net/"Tenant ID(which we got in previous step)"/tokens/OAuth/2

Example:

https://accounts.accesscontrol.windows.net/63cbe529-197e-4e1a-8492-f500e7174ee0/tokens/OAuth/2

Note:

This URL is needed to get the access token.
Apply the below configurations in the header
Method = POST
Headers

KeySyntaxValue
Content-Typeapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded

Body

KeySyntaxValue
grant_typeclient_credentialsclient_credentials
client_idClientID@TenantIDRefer below for the value
client_secretClientSecretRefer below for the value
resourceresource/SiteDomain@TenantIDRefer below for the value

ClientID@TenantID – Value:

97145705-6a29-489a-a577-5a6838efdaed@63cbe529-197e-4e1a-8492-f500e7174ee0

ClientSecret – Value:

ANSe8BFLPOo6oS5TrEzZB320Gz4qhMp+t06Ia+AGINk=

resource/SiteDomain@TenantIDValue:

00000003-0000-0ff1-ce00-000000000000/globalsharepoint2019.sharepoint.com@63cbe529-197e-4e1a-8492-f500e7174ee0
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (11)
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (12)

Click on the Send button:

Now we can see the “Status” as 200 OK which means successful execution. And in the “Body” we can see that “Access_token” has some value – we need to note down this value for the next steps.

Note:

  • Access_token” value is valid just for few a hour – this will be expired after 5 to 6 hours, then again we need to generate the new “Access_token” value.
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (13)

Note down the “access_token” value:

Below is my sample “access_token” value which I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1-mhpxIymLgGt2d0-qHYyZTkjnV7I6J3w2m31yTRaUTrP2yqEbQTVSIOCtt7G-jITPEV-Q7Ce5xpRy017kpBOCkXfaVb2WJHkDiF_0-dUuMzhBhdVl1CL6PdASy6wuehF3kFxBDtE6c91ri3m5m-ZHofYuqYAHluN3oNw9wVeDF3Vga_Hw

Access SharePoint Online using Postman:

We have the “access_token” value from SharePoint online – now we will see how we can connect to Sharepoint online and access Sharepoint online using Postman. Build a REST API query to get the SharePoint online list items like the below:

Syntax:

https://"YourSharePointOnlineSiteUrl"/_api/web?$select=Title

Example:

REST API to get web objects:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web?$select=Title

REST API to get list item objects:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items

The select method as GET

In the URL text box enter the below URL:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items

Headers

KeySyntaxValue
AuthorizationBearer access_tokenBearer “access_token value”
Acceptapplication/json;odata=verboseapplication/json;odata=verbose

Note:

  • After “Bearer” we need to have a single space, then the “access_token” value without quotation.

Then click on the “Send” button – we will get the success result status as 200 OK if everything is fine otherwise we will get access denied or unauthorized access error – then we need to check the permission XML which we have registered in “appinv.aspx” SharePoint online page.

Example below:

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (14)

In the above example, we can see the body – it is a valid successful JSON data that has come from the SharePoint custom list.

You may also read this: Top 5 SharePoint Online Authentication Methods You Need to Know About

Generate code snippet postman:

Now we will generate the corresponding code for the above success request using the generate code snippets feature in postman so that we can inject this code into an actual project file, this really speeds up the productivity.

We can generate code snippets in almost all popular languages, like C#, C, Java, PowerShell, etc.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (15)

Generated code for C# – RestSharp – GET operation:

Below is the generated code for C# – RestSharp from GET operation.

var client = new RestClient("https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items");client.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qfZ2fLalimv2mgVxI-WIl1Mho833t9EG5of_atb1-mhpxIymLgGt2d0-qHYyZTkjnV7I6J3w2m31yTRaUTrP2yqEbQTVSIOCtt7G-jITPEV-Q7Ce5xpRy017kpBOCkXfaVb2WJHkDiF_0-dUuMzhBhdVl1CL6PdASy6wuehF3kFxBDtE6c91ri3m5m-ZHofYuqYAHluN3oNw9wVeDF3Vga_Hw");request.AddHeader("Accept", "application/json; odata=verbose");IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);

Generated code for HTTP – GET operation:

Below is the generated code for HTTP from GET operation.

GET /sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items HTTP/1.1Host: globalsharepoint2019.sharepoint.comAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSIsImtpZCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvZ2xvYmFsc2hhcmVwb2ludDIwMTkuc2hhcmVwb2ludC5jb21ANjNjYmU1MjktMTk3ZS00ZTFhLTg0OTItZjUwMGU3MTc0ZWUwIiwiaXNzIjoiMDAwMDAwMDEtMDAwMC0wMDAwLWMwMDAtMDAwMDAwMDAwMDAwQDYzY2JlNTI5LTE5N2UtNGUxYS04NDkyLWY1MDBlNzE3NGVlMCIsImlhdCI6MTU3ODIwMjE2NiwibmJmIjoxNTc4MjAyMTY2LCJleHAiOjE1NzgyMzEyNjYsImlkZW50aXR5cHJvdmlkZXIiOiIwMDAwMDAwMS0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDBANjNjYmU1MjktMTk3ZS00ZTFhLTg0OTItZjUwMGU3MTc0ZWUwIiwibmFtZWlkIjoiOTcxNDU3MDUtNmEyOS00ODlhLWE1NzctNWE2ODM4ZWZkYWVkQDYzY2JlNTI5LTE5N2UtNGUxYS04NDkyLWY1MDBlNzE3NGVlMCIsIm9pZCI6IjYyZjQyN2E1LWZhOGMtNDU2NS05MTE2LTZlMzRiMDVmOGM0MSIsInN1YiI6IjYyZjQyN2E1LWZhOGMtNDU2NS05MTE2LTZlMzRiMDVmOGM0MSIsInRydXN0ZWRmb3JkZWxlZ2F0aW9uIjoiZmFsc2UifQ.C9jy3VpZDadclNzR-BsulRT_r0YeBTwo7Xn9lk6Yq6-jdHDnL4JdlhyKJI54Pso57qFpbt_TWKYY0oNHiH9Nqi26DihB-4M4qW50H1DsP4c_ZiG_1mUY2V3xEHu7_qfZ2fLalimv2mgVxI-WIl1Mho833t9EG5of_atb1-mhpxIymLgGt2d0-qHYyZTkjnV7I6J3w2m31yTRaUTrP2yqEbQTVSIOCtt7G-jITPEV-Q7Ce5xpRy017kpBOCkXfaVb2WJHkDiF_0-dUuMzhBhdVl1CL6PdASy6wuehF3kFxBDtE6c91ri3m5m-ZHofYuqYAHluN3oNw9wVeDF3Vga_HwAccept: application/json; odata=verbose

SharePoint API -create a new item in the list using Postman:

In the previous example, we have seen how to get list items from SharePoint online using a postman tool with the GET operation – now we will see how we can insert a new item to a SharePoint list using the postman tool with the POST operation.

Enter the URL below:

Syntax:

https://"YourSharePointOnlineSiteUrl"/_api/web?$select=Title

Example:

REST API to get web objects from SharePoint online:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web?$select=Title

REST API to get list items objects from SharePoint online:

https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items

The select method as POST

Headers – In the headers section enter the below key-value parameters:

KeySyntaxValue
AuthorizationBearer access_tokenBearer “access_token value”
Acceptapplication/json;odata=verboseapplication/json;odata=verbose
content-typeapplication/json;odata=verboseapplication/json;odata=verbose
In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (16)

Sharepoint API -create a new item in the list using Postman

Now click on “Body” tab and in the second ribbon row select “raw” and in the last dropdown list, select as “JSON” then enter the below values:

{ "__metadata": {"type": "SP.Data.CustomerListItem"}, "Title": "New Title 1", "CustomerID": "CustomerIDTest001", "CustomerName": "Test customer1", "Address": "Mumbai, India"}

Notes:

  • In the above “SP.Data.CustomerListItem“, “Customer” is list internal name – so the format is “List Internal Name”+ListItem
  • Title, CustomerID, Address are columns in the SharePoint “Customer” list and here we’re passing the values for those columns to add a new item in the list.
  • Similar to the above columns – we can pass as many column values as we want.

Once the above configuration is done – click on the “Send” button. If everything goes fine we will see “Status: 201 Created” like below and in the body section we also can see the valid complete SharePoint successful JSON result.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (17)

Add a new item to SharePoint online list using postman tool – verification:

Now let’s navigate to the SharePoint online “Customer” list – there we can see a new item has been added.

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (18)

Generated code for C# – RestSharp – POST operation:

Below is the generated code for C# – RestSharp – for successful POST operation:

var client = new RestClient("https://globalsharepoint2019.sharepoint.com/sites/SharePointRND/_api/web/lists/getbytitle('Customer')/items");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-type", "application/json;odata=verbose");request.AddHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSIsImtpZCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvZ2xvYmFsc2hhcmVwb2ludDIwMTkuc2hhcmVwb2ludC5jb21ANjNjYmU1MjktMTk3ZS00ZTFhLTg0OTItZjUwMGU3MTc0ZWUwIiwiaXNzIjoiMDAwMDAwMDEtMDAwMC0wMDAwLWMwMDAtMDAwMDAwMDAwMDAwQDYzY2JlNTI5LTE5N2UtNGUxYS04NDkyLWY1MDBlNzE3NGVlMCIsImlhdCI6MTU3ODIwMjE2NiwibmJmIjoxNTc4MjAyMTY2LCJleHAiOjE1NzgyMzEyNjYsImlkZW50aXR5cHJvdmlkZXIiOiIwMDAwMDAwMS0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDBANjNjYmU1MjktMTk3ZS00ZTFhLTg0OTItZjUwMGU3MTc0ZWUwIiwibmFtZWlkIjoiOTcxNDU3MDUtNmEyOS00ODlhLWE1NzctNWE2ODM4ZWZkYWVkQDYzY2JlNTI5LTE5N2UtNGUxYS04NDkyLWY1MDBlNzE3NGVlMCIsIm9pZCI6IjYyZjQyN2E1LWZhOGMtNDU2NS05MTE2LTZlMzRiMDVmOGM0MSIsInN1YiI6IjYyZjQyN2E1LWZhOGMtNDU2NS05MTE2LTZlMzRiMDVmOGM0MSIsInRydXN0ZWRmb3JkZWxlZ2F0aW9uIjoiZmFsc2UifQ.C9jy3VpZDadclNzR-BsulRT_r0YeBTwo7Xn9lk6Yq6-jdHDnL4JdlhyKJI54Pso57qFpbt_TWKYY0oNHiH9Nqi26DihB-4M4qW50H1DsP4c_ZiG_1mUY2V3xEHu7_qfZ2fLalimv2mgVxI-WIl1Mho833t9EG5of_atb1-mhpxIymLgGt2d0-qHYyZTkjnV7I6J3w2m31yTRaUTrP2yqEbQTVSIOCtt7G-jITPEV-Q7Ce5xpRy017kpBOCkXfaVb2WJHkDiF_0-dUuMzhBhdVl1CL6PdASy6wuehF3kFxBDtE6c91ri3m5m-ZHofYuqYAHluN3oNw9wVeDF3Vga_Hw");request.AddHeader("Accept", "application/json; odata=verbose");request.AddParameter("application/json;odata=verbose", "{\n \"__metadata\": {\"type\": \"SP.Data.CustomerListItem\"},\n \"Title\": \"New Title 1\",\n \"CustomerID\": \"CustomerIDTest001\",\n \"CustomerName\": \"Test customer1\",\n \"Address\": \"Mumbai, India\"\n\n}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);

Generated code for HTTP – POST operation:

Below is the generated code for HTTP – for successful POST operation:

POST /sites/SharePointRND/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-4M4qW50H1DsP4c_ZiG_1mUY2V3xEHu7_qfZ2fLalimv2mgVxI-WIl1Mho833t9EG5of_atb1-mhpxIymLgGt2d0-qHYyZTkjnV7I6J3w2m31yTRaUTrP2yqEbQTVSIOCtt7G-jITPEV-Q7Ce5xpRy017kpBOCkXfaVb2WJHkDiF_0-dUuMzhBhdVl1CL6PdASy6wuehF3kFxBDtE6c91ri3m5m-ZHofYuqYAHluN3oNw9wVeDF3Vga_HwAccept: application/json; odata=verbose{ "__metadata": {"type": "SP.Data.CustomerListItem"}, "Title": "New Title 1", "CustomerID": "CustomerIDTest001", "CustomerName": "Test customer1", "Address": "Mumbai, India"}

Easily we can inject the above codes into our respective programming language wherever it fits.

Summary: Access SharePoint online data using postman tool

Thus, in this article we have learned the below topics with respect to SharePoint online and the postman tool:

  • Introduction to Postman for API Development
  • What is the postman tool?
  • How to Use Postman to Manage and Execute Your APIs?
  • What is the use of REST API in SharePoint?
  • Access SharePoint Online using Postman
  • GET and POST method in SharePoint online using postman tool
  • Accessing SharePoint Data using Postman (SharePoint REST API)
  • Postman tool and SharePoint online REST API
  • Download postman for windows – where can we download the postman tool?
  • Authentication Policies – SharePoint online
  • Authorize Postman to access SharePoint
  • Register Add-In – SharePoint online
  • Grant Permissions to Add-In
  • Add-in permissions in SharePoint – App permission
  • Differences between add-in permission rights and user rights
  • Retrieve the Tenant ID in the Postman tool
  • Generate access token – how to generate an access token in postman?
  • Access SharePoint Online using Postman
  • Generate code snippet postman
  • Generated code for C# – RestSharp – GET operation
  • Generated code for HTTP – GET operation
  • SharePoint API -create a new item in the list using Postman:

See Also: Access SharePoint online data using postman tool

You may also be interested in the following articles:

  • The Ultimate Postman Tutorial: A Beginner’s Guide to REST API Testing step by step
  • Basic understanding of REST API in SharePoint online – CRUD Operations
  • SharePoint admin center: Learn SharePoint online administration in an hour – step by step
  • Office 365: Where do the Microsoft Teams channel conversations and files get saved?
  • Office 365: Add Channel in Microsoft Teams – o365
  • Office 365: SharePoint vs Microsoft Teams – Understanding the Differences in o365
  • Office 365: Understanding the hub site in SharePoint online
  • Add-in permissions in SharePoint
  • Granting access using SharePoint App-Only

Request: If this article helps you, please appreciate our efforts by writing a comment below or if you have a better idea/solution to this topic, please write a comment, we will include that in this article. Thank you, happy reading, learning, and Sharing. 🙂

About Post Author

SP Doctor

I am your SharePoint and Power Platform doctor and guide. Sharing knowledge with my fellow colleagues, friends, and the tech community makes me utmost happy in my job.

See author's posts

Related

In 4 steps access SharePoint online data using postman tool - Global SharePoint Diary (2024)

References

Top Articles
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5920

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.