Thanks for the help, I'm already making some progress, I'm creating a script in powershell that gives me all the inventory I have in lansweeper, the problem I have now is that when I run it it gives me an error "Invoke-RestMethod: {"errors" :[{"message":"Cannot query field 'allAssets' on type 'Query'."}]}"
I know these are basic questions, I'm not an expert in using APIs either, but I need to be able to do this, which I think is basic. What else could be going wrong?
My Script
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Token xxxxxxxxxxxxxxxxxxxxxxxx"
}
$query = @"
{
allAssets {
items {
id
name
type
status
}
}
}
"@
$body = @{
query = $query
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri "https://api.lansweeper.com/api/v2/graphql" -Method Post -Headers $headers -Body $body -Verbose
if ($response -eq $null) {
Write-Output "Error."
} else {
$response
}