Postman to Sharepoint REST callout giving Error: read ECONNRESET issue

Nishant Khandelwal 20 Reputation points
2023-11-05T00:00:29.3233333+00:00

Hi All,

I am trying to make a callout from postman to sharepoint.

I have made the authentication using - https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/

And when I am trying to do a post on - https://xxx.sharepoint.com/sites/xxx/_api/web/folders

Header -

Authorization - Bearer xxx

Accept - application/json;odata=verbose

Content-Type - application/json

Content-Length - 148

Body

-

{

"__metadata": {

"type": "SP.Folder"

},

"ServerRelativeUrl": "https://xxx.sharepoint.com/sites/xxx/newfolder1"

}

I am getting the following error - Error: read ECONNRESET

The callout for tenant and access token are successful.

Please let me know how to fix it.. or Is there a way to no what is going wrong somewhere i can see logs or something.

Thanks in advance,

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,787 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,698 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 31,846 Reputation points Microsoft Vendor
    2023-11-06T03:13:27.0133333+00:00

    Hi @Nishant Khandelwal ,

    Per my test, the Permission Request XML in the article is incomplete. The correct XML should be like following

    <AppPermissionRequests AllowAppOnlyPolicy="true">
      <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
    </AppPermissionRequests>
    

    You could recreate a sharepoint app only with the correct XML. And set the request like following

    POST https://xxxx.sharepoint.com/sites/xxxxx/\_api/web/folders
    Authorization: "Bearer " + accessToken
    Accept: "application/json;odata=verbose"
    Content-Type: "application/json;odata=verbose"
    

    191080-image.png

    The body should be like this

    {
    

    In your case, you are missing the listname in ServerRelativeUrl.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful