PanoramicData.LanSweeper.Api
12.5.13
dotnet add package PanoramicData.LanSweeper.Api --version 12.5.13
NuGet\Install-Package PanoramicData.LanSweeper.Api -Version 12.5.13
<PackageReference Include="PanoramicData.LanSweeper.Api" Version="12.5.13" />
<PackageVersion Include="PanoramicData.LanSweeper.Api" Version="12.5.13" />
<PackageReference Include="PanoramicData.LanSweeper.Api" />
paket add PanoramicData.LanSweeper.Api --version 12.5.13
#r "nuget: PanoramicData.LanSweeper.Api, 12.5.13"
#:package PanoramicData.LanSweeper.Api@12.5.13
#addin nuget:?package=PanoramicData.LanSweeper.Api&version=12.5.13
#tool nuget:?package=PanoramicData.LanSweeper.Api&version=12.5.13
LanSweeper.Api
A comprehensive .NET library for the LanSweeper Data API (GraphQL), providing easy access to LanSweeper's inventory and asset management data.
Features
- Full GraphQL Support: Complete access to LanSweeper's GraphQL Data API
- Type-Safe: Strongly typed C# models for all API responses
- Modern .NET: Built for .NET 9 with modern C# patterns
- Authentication: Seamless Personal Access Token (PAT) authentication
- Error Handling: Comprehensive error handling and custom exceptions
- Async/Await: Full async support for non-blocking operations
- Pagination: Built-in support for GraphQL cursor-based pagination
- Logging: Integrated logging support via Microsoft.Extensions.Logging
- Modular Design: Organized API structure supporting multiple LanSweeper APIs
Quick Start
Installation
Install the package via NuGet:
dotnet add package LanSweeper.Api
Basic Usage
using LanSweeper.Api;
// Create client with Personal Access Token
var options = new LanSweeperClientOptions
{
AccessToken = "your-personal-access-token"
};
var client = new LanSweeperClient(options);
// Get authorized sites
var sites = await client.Data.Sites.GetAllAsync();
// Get assets from a site
var assets = await client.Data.Assets.GetBySiteAsync("site-id");
// Execute custom GraphQL query
var result = await client.Data.Reports.ExecuteQueryAsync<CustomModel>("{ your custom query }");
Authentication
LanSweeper.Api uses Personal Access Tokens (PATs) for authentication. To get started:
- Log into your LanSweeper portal
- Navigate to API Access settings
- Generate a Personal Access Token
- Use the token in your
LanSweeperClientOptions
var options = new LanSweeperClientOptions
{
AccessToken = "your-personal-access-token",
GraphQLEndpoint = "https://api.lansweeper.com/api/v2/graphql" // Optional: defaults to this
};
API Structure
The client is organized into logical API groups:
Data API (GraphQL)
Access to LanSweeper's GraphQL Data API for inventory and asset management:
// Sites API
var sites = await client.Data.Sites.GetAllAsync();
var site = await client.Data.Sites.GetByIdAsync("site-id");
// Assets API
var assets = await client.Data.Assets.GetBySiteAsync("site-id");
var asset = await client.Data.Assets.GetByIdAsync("asset-key");
// Users API
var currentUser = await client.Data.Users.GetCurrentAsync();
// Reports API (Custom Queries)
var result = await client.Data.Reports.ExecuteQueryAsync<T>(query, variables);
Available Modules
Data API
- Sites: Manage and query LanSweeper scanning sites
- Assets: Access IT inventory and asset data
- Reports: Execute custom reports and queries
- Users: User and permissions management
Note: Support for additional LanSweeper APIs (Device Recognition API, Platform API) coming in future releases.
Documentation
Requirements
- .NET 9.0 or later
- Valid LanSweeper account with API access
- Personal Access Token
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Note: This is an unofficial library. LanSweeper is a trademark of Lansweeper NV.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- GraphQL.Client (>= 6.1.0)
- GraphQL.Client.Serializer.SystemTextJson (>= 6.1.0)
- Microsoft.Extensions.Http (>= 10.0.6)
- Microsoft.Extensions.Logging (>= 10.0.6)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Changelog can be found at https://github.com/panoramicdata/LanSweeper.Api/blob/main/CHANGELOG.md