Skip to content

Latest commit

History

71 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

SnipeSharp

A .NET wrapper for the Snipe IT API written (poorly) in C#.

Before You Dive In

The goal of this project is to give easy access to all endpoints of the Snipe IT API via C#. With that said, this build is currently a rough demo. Most of the endpoints work as expected but plan on things breaking or not working 100%.

This project was built to support my own needs. As such features are being worked on in the order I personally need them. However, if you want a feature or find a bug please open an issue.

Final note, this is my first C# project of this scale. I'm not up on all the best practices. If you see something I've done that should be done differently, I encourge you to let me know.

Prerequisites

A Working Install of Snipe IT V4+

Installation

nuget install SnipeSharp

Usage

SnipeItApisnipe=newSnipeItApi();snipe.ApiSettings.ApiToken="XXXXXXXX"
snipe.ApiSettings.BaseUrl=newUri("http://xxxxx.com/api/v1")

Each endpoint has it's own manager assigned to the SnipeItApi object. Example, SnipeItApi.AssetManager

Each endpoint has a common set of actions. With the exception Assets, Status Labels and Users which use extended managers to deal with extra API functions associated with them.

Common Actions

Return all objects at this end point

snipe.AssetManager.GetAll()

Find all objects matching certain filtering criteria

snipe.AssetManager.FindAll(ISearchFilterfilter)

Find first object matching search criteria

snipe.AssetManager.FindOne(ISearchFilterfilter)

Get object with ID

snipe.AssetManager.Get(intID)

Search for object with given name

snipe.AssetManager.Get(stringname)

Create an object

snipe.AssetManager.Create(ICommonEndpointObjectitem)

Update an object

snipe.AssetManager.Update(ICommonEndpointObjectitem)

Delete an object

snipe.AssetManager.Delete(intid)

Examples

Create a new asset

Assetasset=newAsset(){Name="Loaner1",AssetTag="12345678",Model=snipe.ModelManager.Get("Lenovo"),Status=snipe.StatusLabelManager.Get("Ready to Deploy"),Location=snipe.LocationManager.Get("Maine")};snipe.AssetManager.Create(asset);

Update an Asset

Assetasset=snipe.AssetManager.Get("Loaner1");asset.Serial="1i37dpc3k";snipe.AssetManager.Update(asset);

Get all assets from made by a certain manufacturer

AssetSearchFilterfilter=newAssetSearchFilter(){Manufacturer=snipe.ManufacturerManager.Get("Lenovo")};varresult=snipe.AssetManager.FindAll(filter);

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

About

A c# wrapper for the Snipe IT API

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages