Postman to Sharepoint REST callout giving Error: read ECONNRESET issue

Anonymous
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,

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2023-11-06T03:13:27.0133333+00:00

    Hi @Anonymous ,

    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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.