Hi Dominik,
yes i solved my problem, with not rest api calls but with c# wrapper of it
the code is not refactored as i was prototyping its a mess, but
if i remember correctly i was looking for a specific link id cause from logs i saw that it was crashing the webbrowser, so when i found its id i looped all links and deleted it , that fixed the problem
rest of the code is here:
the usings are:
using Trimble.Identity;
using Trimble.Identity.OAuth.AuthCode;
using MO = Trimble.Connect.Client.Models;
var projects = await client.GetProjectsAsync();
var myProject = projects.Where(a => a.Name == "YOUR-PROJECT-NAME").FirstOrDefault();
var projectClient = await client.GetProjectClientAsync(myProject);
var linkParams = new Dictionary<string, string>() { { "id", "FYCWjs_SQ24" },
{ "detail", "true" } };
IQueryResult<MO.EntityLink> links = await projectClient.Links.GetAllAsync(linkParams);
// Source - model object , target - file
var groupedLinks = links
.SelectMany(src => src.Source.Elements, (link, src) => new { link, src })
.GroupBy(e => ((MO.ModelElementSource)e.src).Identifier);
ObjectLinks objects = new ObjectLinks();
Dictionary<string, List<string>> duomenys = new Dictionary<string, List<string>>();
foreach (var item in groupedLinks)
{
var Listas = new List<string>();
foreach (var i in item)
{
Listas.Add(i.link.Identifier);
}
duomenys.Add(item.Key, Listas);
}
objects.Objects = duomenys;
JsonSerializer serializer = new JsonSerializer();
using (StreamWriter sw = new StreamWriter(@"C:\Users\USERNAMEHERE\Desktop\data.json"))
using (JsonWriter writer = new JsonTextWriter(sw))
{
serializer.Serialize(writer, objects);
}
string stop = string.Empty;
// DELETE LINKS BY ID
foreach (var item in links)
{
//await projectClient.Links.DeleteAsync(item.Identifier);
}
// TODO : Probleminis ID
//await projectClient.Links.DeleteAsync("9gxqPfgxXjo");
//await projectClient.Links.DeleteAsync("hu1HHdHL6KA");