api
10 TopicsGetting News articles using REST API
Hello, We have a site for newsroom, where we are displaying all news articles. I need to create a rest API to read this information and display it on our REACT based app. I am unable to get hold of a URL that would provider me with this Information. I have tried following URLS but I am not getting the desired results https://<tenant>.sharepoint.com/sites/iNewsroom/_api/Web/Lists/getByTitle('Site%20Pages')/items?$select=* https://intermountainhealth.sharepoint.com/_api/search/query?querytext=%27IsDocument:True%20AND%20FileExtension:aspx%20AND%20PromotedState:2%27 https://<tenant>.sharepoint.com/search/_api/search/query?querytext=%27IsDocument:True%20AND%20FileExtension:aspx%20AND%20PromotedState:2%27\ Is there any other URL I can try to get the information? The newsroom site has a few sitep741Views0likes0Comments401 (Unauthorized) When calling Sharepoint Query
Hello everyone, I am currently getting this error 401 when I try to call my Sharepoint Endpoint. It occurred after I added the following below into the header. What is the issue here? GET http://www.test.com/Shared%20Documents/query%20result%20BEFORE.xml 401 (Unauthorized) Previously, I was facing this error: Access to XMLHttpRequest at **** from origin 'http://127.0.0.1:1234' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I added the Access-Control-Allow-Origin with a value of "*" in the HTTP Response Headers and now I am getting the 401 error. Please do help! Thank you!12KViews0likes3CommentsSharepoint CORS Policy issue persist even after ISS Configurations
I am currently trying to fetch my Sharepoint API via my code. However I am running into the issue below. I have already enabled the ISS Configurations as shown in the link below. However, the issue still persist. https://techcommunity.microsoft.com/t5/iis-support-blog/access-to-xmlhttprequest-from-origin-has-been-blocked-by-cors/ba-p/3800362 Error: index.html:1 Access to XMLHttpRequest at 'http://testing- sharepoint/Shared%20Documents/query%20result%20BEFORE.xml' from origin 'http://127.0.0.1:2233' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. My code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { function apiCallTest(searchValue) { const adminAccount = 'testUser'; const adminAccountPassword = 'testPassword'; const auth = btoa(`${adminAccount}:${adminAccountPassword}`); const testQuery = 'BEFORE'; const apiUrl= "http://testing-sharepoint/Shared%20Documents/query%20result%20BEFORE.xml" const headers = { 'Authorization': `Basic ${auth}`, // 'Accept': 'application/json;odata=nometadata', // 'Content-Type':'application/json', // 'Access-Control-Allow-Credentials':'TRUE', // 'Access-Control-Allow-Headers':'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers,Authorization', // 'Access-Control-Allow-Origin':'*', // 'Access-Control-Allow-Methods':'GET,POST,PUT,OPTIONS' }; $.ajax({ url: apiUrl, headers: headers, method: 'GET', dataType: 'xml', success: function(data) { // Process the search results as needed console.log('Search Results:', data) }, error: function(xhr, textStatus, errorThrown) { console.log("Cannot connect") console.error('Error:', xhr, textStatus, errorThrown); } }); } function checkConnection(url) { if (navigator.onLine) { console.log(`You are online. Checking connection to ${url}...`); // You can attempt further actions here if needed } else { console.log('You are offline. Check your network connection.'); } } checkConnection("https://testing-sharepoint/_api/site"); apiCallTest(); }); </script> </head> <body style="background: black; color: aliceblue; font-size: 2rem;"> </body> </html>1.5KViews0likes0CommentsIs there an SharePoint API endpoint for views?
I'm trying to automate collection of metrics for articles on our SharePoint sites. There are some good articles on doing this for likes and comments using the SharePoint API and Power Automate, but I can't find any endpoints to do the same for the number of views each article received. Anyone know if there's an endpoint that has views?SolvedI'm a SysAdmin and need understanting of API REST CSOM Microsoft Graph
Hi, I'm a SharePoint SysAdmin and need to understand the way to access SharePoint Online site to: drop, Acces or delete file to libraires. Just need to clarify my knowledge to argue with the development Team There seem to be 3 API to accès sites: REST API CSOM API and the new one Microsoft Graph Is theres others? With one is the best et secure way to use? Sebastien Lepage1.2KViews0likes3CommentsMicrosoft Sharepoint REST API
Hello, How to implement REST API in sharepoint in order to get some part of content in columns format. For example, I pass rest api and getting result. Before passing we have Name Date Status After passing we have , for example, Name Date Status Worker Date_created .. .. etc. Do I need to create that api or it already exists?594Views0likes0CommentsConsume secured API in SPFX
I tried to consume a secure API( function) from Azure. I created a new SPFX package. I want to get a new WebApplicationRequest for permission in SharePoint admin API Access console. When i tried to approve the new installed package get the error "resourceId cannot be empty". My package-solution.json has the following settings "webApiPermissionRequests": [ {"resource": "contoso-api-dp20191109","scope": "user_impersonation" }]}. I would be grateful if you have any suggestion?1.1KViews0likes0CommentsInconsistent responses from SharePoint365 API
We use the legacy Sharepoint API to ingest all content from not only SharepointOnline/365 but also Sharepoint 2013 and 2016. Unfortunately, while ingesting data from a Sharepoint 365 site, the API is not behaving in a consistent way. Consistently, it reports that certain items do not exist when the site has not been modified and we can see said items in the expected location. For example: DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> GET /sites/sonyhack/_api/web/GetFileByServerRelativeUrl('%2f%2fsites%2fsonyhackShared%20Documents%2fFinance-1%2fSPI%2fFinance%2f21-SOX%20-%20Internal%20Audit%2fFY14%2fRef%20%2317.6%20LON_Prod%20Acctg%20Fee_WE%20140302.xlsx') HTTP/1.1 DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> User-Agent: NONISV|Exonar|Slurp/1.0 DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> X-RequestDigest: 0x31C66DB00416F265FCD915032E30EF736B3AC796F59873EBF593105231E91D0683FD26F857E0854958C30C7D45AFD6CB5DA4B2DABC7D06133631A74FCA9A9F86,29 Jul 2019 22:40:45 -0000 DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Host: exonarltd.sharepoint.com DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Connection: Keep-Alive DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Cookie: FedAuth=77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48U1A+VjYsMGguZnxt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FETTjK8yl6gRT0W4g8/FeArW2ME6QdmXm1Cy+NDjI/+gxOQ2hqpEAQ3vPsa0h+xAh235SiCMX0gBV+vFa8A7AFH+jzQzyuYlVH2Cwy6KVqdvNpqeyBQoVejio5ySQgljpY77o89sH5d35hJHuUOOQr7RsrZdZ69Ewm5B3p9AfqO0Es+T8uqHPOxowWe2tSIku0oo7JkILJAgda8LXXkNHwTXQEUT2CgUUAAAA= DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Cookie2: $Version=1 DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Accept-Encoding: gzip,deflate DEBUG 2019-07-29 23:04:17,513 (Worker thread '0') - http-outgoing-129363 << HTTP/1.1 404 Not Found And yet, the item is there, not having been modified for months. In other situations, these failures are intermittent, with an item being reported as missing on one run to then be seen the next run and disappear again on the following run. This makes us unable to get a consistent view on Sharepoint sites as, if one of those items is a folder, we end up not only not seeing it but any of the contents within. Is this something others have experienced? Is there a workaround? Thank you for your help1.3KViews0likes2CommentsPushing Content from SharePoint 2013/2016 to Mobile App
Hi Need to check whether a Solution we are proposing is the best method. I am not a developer so might need some guidance on the best way to suggest a solution. We have an OnPrem SharePoint 2013 and 2016 farms. External users need access and cant be added to the client domain and form's auth is not an option. There will be content that gets published and approved and that need to be somehow published to the mobile app. A developer has proposed a mobile app that can pull data via REST/SOAP. or what API? Firstly looks like SOAP has been depreciated? So will rest be the best option? Then we are thinking of Developing a TimerJob that can just push the data to a SQL DB and then the App to pull it from the DB? Before we reinvent the wheel, or maybe there are easier ways to accomplish this I would love some feedback. Would also be good if we do this in a way that will work if they migrate to SharePoint Online. Thanks in advance.1.2KViews0likes1Comment