I've stumbled upon issue where I need to create a link in navigation from root site which points to site collections.
POST Request URL: https://contoso.sharepoint.com/_api/web/navigation/TopNavigationBar
Body:
{
"__metadata": {
"type": "SP.NavigationNode"
},
"Url": "https://contoso.sharepoint.com/sites/nonexisting",
"Title": "Non existing"
}
Error response:
{
"odata.error": {
"code": "-2130247147, Microsoft.SharePoint.SPException",
"message": {
"lang": "en-US",
"value": "Cannot open \"/sites/nonexisting\": no such file or folder."
}
}
}
Tried to create it manually - works fine. Got new link by REST API to check properties:
{
"AudienceIds": null,
"CurrentLCID": 1033,
"Id": 7617,
"IsDocLib": true,
"IsExternal": true,
"IsVisible": true,
"ListTemplateType": 0,
"Title": "Nonexisting",
"Url": "/sites/nonexisting"
}
Nothing out of ordinary.
I'm wondering, is it even possible to create such links with REST API?