CSM.SodaDotNet 0.10.1

dotnet add package CSM.SodaDotNet --version 0.10.1                
NuGet\Install-Package CSM.SodaDotNet -Version 0.10.1                
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="CSM.SodaDotNet" Version="0.10.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSM.SodaDotNet --version 0.10.1                
#r "nuget: CSM.SodaDotNet, 0.10.1"                
#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.
// Install CSM.SodaDotNet as a Cake Addin
#addin nuget:?package=CSM.SodaDotNet&version=0.10.1

// Install CSM.SodaDotNet as a Cake Tool
#tool nuget:?package=CSM.SodaDotNet&version=0.10.1                

SODA.NET Build status

A Socrata Open Data API (SODA) client library targeting .NET 4.5 and above.

Getting Started

SODA.NET is available as a NuGet package.

dotnet add package CSM.SodaDotNet

Usage examples

Simple, read-only access

//initialize a new client
//make sure you register for your own app token (http://dev.socrata.com/register)
var client = new SodaClient("data.smgov.net", "REPLACE_WITH_YOUR_APP_TOKEN");

//read metadata of a dataset using the resource identifier (Socrata 4x4)
var metadata = client.GetMetadata("1234-wxyz");
Console.WriteLine("{0} has {1} views.", metadata.Name, metadata.ViewsCount);

//get a reference to the resource itself
//the result (a Resouce object) is a generic type
//the type parameter represents the underlying rows of the resource
var dataset = client.GetResource<Dictionary<string, object>>("1234-wxyz");

//of course, a custom type can be used as long as it is JSON serializable
var dataset = client.GetResource<MyClass>("1234-wxyz");

//Resource objects read their own data
var allRows = dataset.GetRows();
var first10Rows = dataset.GetRows(10);

//collections of an arbitrary type can be returned
//using SoQL and a fluent query building syntax
var soql = new SoqlQuery().Select("column1", "column2")
                          .Where("something > nothing")
                          .Group("column3");

var results = dataset.Query<MyOtherClass>(soql);

SodaClient is also capable of performing write operations

//make sure to provide auth credentials!
var client = 
    new SodaClient("data.smgov.net", "AppToken", "user@domain.com", "password");

//Upsert some data serialized as CSV
string csvData = File.ReadAllText("data.csv");
client.Upsert(csvData, SodaDataFormat.CSV, "1234-wxyz");

//Upsert a collection of serializable entities
IEnumerable<MyClass> payload = GetPayloadData();
client.Upsert(payload, "1234-wxyz");

Note: This library supports writing directly to datasets with the Socrata Open Data API. For write operations that use data transformations in the Socrata Data Management Experience (the user interface for creating datasets), use the Socrata Data Management API. For more details on when to use SODA vs the Socrata Data Management API, see the Data Management API documentation

Build

Compilation can be done using Visual Studio Community Edition.

You can also use the .NET CLI:

git clone git@github.com:CityofSantaMonica/SODA.NET.git SODA.NET
cd SODA.NET
dotnet build

Tests

NUnit was used to build and run the test projects.

Run tests from the Visual Studio Test Explorer, or using the .NET CLI:

dotnet test

Contributing

Check out the Contributor Guidelines for more details.

Copyright 2019 City of Santa Monica, CA

Licensed under the MIT License

Thank you

A tremendous amount of inspiration for this project came from the following projects. Thank you!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CSM.SodaDotNet:

Package Downloads
CSM.SodaDotNet.Utilities

Library of helper classes and extension methods for working with Socrata Open Data portals.

GitHub repositories

This package is not used by any popular GitHub repositories.