Forum Discussion
SP /_api/$batch endpoint - "Resource Not Found"
Sharepoint issue and needing some feedback;
I need to update my sp library with a new column with an int value, there are ~83k records and to best do this i wanted to try and use the SP /_api/$batch endpoint. Issue is that flow is saying it cannot find the $batch endpoint. I have worked with our head of IT admin to examin MS Entra and our SP perms but nothing is surfacing, any thoughts?
1 Reply
- ZoeyAdamsIron Contributor
1. URL normalisation
powershell
# Validate site URL format (must contain the correct tail)
$correctUrl = ‘https://contoso.sharepoint.com/sites/team/_api/$batch’
2. Privilege repair commands
powershell
Connect-SPOService -Url https://contoso-admin.sharepoint.com
Grant-SPOHubSiteRights -Identity https://contoso.sharepoint.com/sites/team -Principals ‘email address removed for privacy reasons’ -Rights FullControl
3. Special configuration for mixed environments
xml
<! -- Application manifest to be added -->
<ApplicationPermissions
<AppPermissionRequests>
<AppPermissionRequest Scope=‘https://contoso.sharepoint.com/sites/team’ Right=‘FullControl’ />
</AppPermissionRequests>
</ApplicationPermissions
Run HTML
4. Enterprise level debugging solution
1. Fiddler captures the request
javascript
// Make sure the request headers contain:
headers: {
‘Accept": “application/json;odata=verbose”,
‘Content-Type": ’multipart/mixed; boundary=batch_xyz’
}
5... Postman test template
http
POST https://contoso.sharepoint.com/sites/team/_api/$batch
Headers.
Authorization: Bearer {token}
X-RequestDigest: {formdigest}
6. Body.
--batch_xyz
Content-Type: application/http
Content-Transfer-Encoding: binary
GET https://contoso.sharepoint.com/sites/team/_api/web/title HTTP/1.1
--batch_xyz--
7. Service Main Configuration
powershell
Register-PnPAzureADApp -ApplicationName ‘SPBatchApp’ -Store AzureKeyVault -Tenant contoso.onmicrosoft.com
8. Resource Validation Scripts
powershell
$site = Get-SPOSite ‘https://contoso.sharepoint.com/sites/team’
$site.Url -match ‘/(sites|teams)/’ ? ‘Valid’ : ’Invalid Structure’
9. Mixed environment route checking
powershell
Test-SPO365Endpoint -Url ‘https://contoso.sharepoint.com’ -Type SPO
10. Proxy Configuration Fix
powershell
netsh winhttp set proxy proxy-server=‘http=proxy.contoso.com:8080’ bypass-list="*.sharepoint.com’
11.CSOM fallback
csharp
ClientContext.ExecuteQueryWithRetry(3, 1000);
12. REST chunking
javascript
/_api/web/GetFolderByServerRelativeUrl(‘/sites/team’)/Files?$top=500
13. Graph API replacement
http
POST https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{item-id}/workbook/worksheets/{id}/range(address=‘A1:B2’)