How to access Sharepoint REST API in my function app

GBS-SharePoint-Admin 1 Reputation point
2021-06-10T12:41:55+00:00

My function app is triggered via an external webhook, whenever it is triggerd i want to update data in a list in my sharepoint site, I tried following the steps here (https://www.c-sharpcorner.com/blogs/setting-for-sharepoint-online-to-accessible-from-external-environment) but i'm getting 404 error as a response everytime, is there any other way to access sharepoint rest api from my azure function? Please Help

My code snippet from my node.js function that i tried for authentication (I've hidden the sensitive credentials with star)
const formData = new FormData();

    formData.append('grant_type', 'client_credentials');
    formData.append('client_id', '***@****');
    formData.append('client_secret', '*****');
    formData.append('resource', '00000003-0000-0ff1-ce00-000000000000/***@****);

    const res = await axios.post('https://accounts.accesscontrol.windows.net/******/tokens/OAuth/2', formData, {
          headers: {
            'Content-Type':'application/x-www-form-urlencoded'
        }
    });
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,971 questions
{count} votes

Your answer

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