ServiceNow.Api 1.3.36

There is a newer version of this package available.
See the version list below for details.
dotnet add package ServiceNow.Api --version 1.3.36
                    
NuGet\Install-Package ServiceNow.Api -Version 1.3.36
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ServiceNow.Api" Version="1.3.36" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ServiceNow.Api" Version="1.3.36" />
                    
Directory.Packages.props
<PackageReference Include="ServiceNow.Api" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ServiceNow.Api --version 1.3.36
                    
#r "nuget: ServiceNow.Api, 1.3.36"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ServiceNow.Api@1.3.36
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ServiceNow.Api&version=1.3.36
                    
Install as a Cake Addin
#tool nuget:?package=ServiceNow.Api&version=1.3.36
                    
Install as a Cake Tool

ServiceNow.Api

Nuget Nuget License: MIT Codacy Badge

Usage

To create a simple command line app that uses the ServiceNow REST API:

  1. Create a .NET Core 10.0 Console project in Visual Studio
  2. Ensure that you have specified <LangVersion>latest</LangVersion> in the csproj file, e.g.:
<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>net10.0</TargetFramework>
		<LangVersion>latest</LangVersion>
		<Nullable>enable</Nullable>
		<AnalysisMode>Recommended</AnalysisMode>
		<AnalysisLevel>latest-recommended</AnalysisLevel>
	</PropertyGroup>

	<ItemGroup>
		<Folder Include="Properties\" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
		<PackageReference Include="ServiceNow.Api" Version="1.2.*" />
	</ItemGroup>

</Project>

  1. Edit Program.cs to be similar to the following:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ServiceNow.Api.Example;

public static class Program
{
	public async static Task Main(string[] args)
	{
		var account = args[0];
		var username = args[1];
		var password = args[2];

		Console.WriteLine("Lists Windows Servers");

		using var serviceNowClient = new ServiceNowClient(account, username, password, new Options());

		// MANDATORY: The table name can be obtained from this list:
		// https://docs.servicenow.com/bundle/london-platform-administration/page/administer/reference-pages/reference/r_TablesAndClasses.html
		const string tableName = "cmdb_ci_win_server";

		// OPTIONAL: The main sysparm_query goes here.  See documentation here:
		// https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/reference/r_TableAPI-GET.html
		// If you omit this, an unfiltered result will be returned
		const string query = "name";

		// OPTIONAL: The fields to bring back.
		// This should be set to constrain the response to ONLY the fields that you are going to process.
		// Doing so will hugely speed up your query.
		var fields = new List<string> { "sys_id", "name" };

		var jObjectResults = await serviceNowClient.GetAllByQueryAsync(
			tableName,
			query,
			fields
			).ConfigureAwait(false);

		var modelResults = jObjectResults.ConvertAll(o => o.ToObject<WinServerModel>());

		Console.WriteLine("Windows Servers:");
		foreach (var modelResult in modelResults)
		{
			Console.WriteLine($"  - {modelResult.Id}: {modelResult.Name}");
		}
	}
}

[DataContract]
public class WinServerModel
{
	[DataMember(Name = "sys_id")]
	public string Id { get; set; }

	[DataMember(Name = "name")]
	public string Name { get; set; }
}
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.38 998 9/12/2026
1.3.36 159 9/12/2026
1.3.35 101 9/12/2026
1.3.30 702 8/30/2026
1.3.26 1,461 8/4/2026
1.3.23 260 8/4/2026
1.3.8 17,949 12/18/2025
1.3.7 14,687 7/3/2025
1.3.1 31,134 8/13/2024
1.2.60 32,284 2/23/2023
1.2.36 23,451 5/10/2022
1.2.34 19,176 4/9/2021
1.2.32 737 3/30/2021
1.2.28 654 3/29/2021
1.2.27 2,903 12/22/2020
1.2.20 3,740 5/21/2020
1.2.17 864 5/7/2020
1.2.9 15,234 12/11/2019
1.2.8 1,320 10/3/2019
1.2.7 827 10/3/2019
Loading failed

Fixes querying a table or view that has no paging field.

Automatic paging orders on sys_created_on. The check for that field being absent used to be reached only when a page came back full, so a small result from a view with no date/time column was served in a single request and never met it. Terminating paging on an empty page instead moved the check onto every page, and those queries began failing outright where they had always worked.

The field is now required only when records remain to be collected: a full page, or a retrieved count that falls short of the reported total by more than the configured tolerance. A genuine shortfall still raises rather than truncating silently, and the message now names the paging problem and the option that resolves it.