Rest call to SP Online site from SP 2013 javascript code

Harish Patil 21 Reputation points
2021-02-23T13:09:43.017+00:00

Hi All,

I have SP Online site with list and SP 2013 site. I want to access SP Online list into SP 2013 site using REST call.

Can anyone please help me how to achieve this? Please provide some sample code for the same.

Thanks,
Harish Patil

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,012 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,591 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2021-02-24T09:14:32.163+00:00

    When we call the rest API of SharePoint online in SharePoint 2013, we need to perform identity authentication. We could use Microsoft Authentication Library (MSAL).
    Official demo:Tutorial: Sign in users and call the Microsoft Graph API from a JavaScript single-page application (SPA)
    Similar issue for your reference:
    Unauthorized request in Sharepoint API with MSAL token
    Access SharePoint Online "_api/web/..." api using the MSAL library

    Or you could try to copy the list from online to 2013, and then request this rest API in 2013 directly.


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.