cofl / snipesharp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from barrycarey/snipesharp
A c# wrapper for the Snipe IT API
License: MIT License
This project forked from barrycarey/snipesharp
A c# wrapper for the Snipe IT API
License: MIT License
The SnipeIT JSON is returning an "assigned_to" integer that isn't being mapped
Newtonsoft.Json.JsonSerializationException: 'Error converting value 864 to type 'SnipeSharp.Models.AssetAssignedTo'. Path 'payload.assigned_to', line 1, position 250.'
To replicate change some elements on an asset that is assigned to a user and call the update asset.
Hi!
I'm trying to add a asset to SnipeIT, but when i add the PurchaseDate, i get an error.
Code:
SnipeSharp.Models.AssetStatus assetStats = new SnipeSharp.Models.AssetStatus();
assetStats.StatusId = 2;
DateTime purchasedate= Convert.ToDateTime("01.01.2020");
asset.AssetTag = "Test";
asset.Model = snipe.Models.Get(5);
asset.Name = sHostname;
asset.Serial = "ABCDE";
asset.Status = assetStats;
asset.PurchaseDate = purchasedate;
asset.WarrantyMonths = 36;
snipe.Assets.Create(asset);
Error:
{"{\n \"message\": \"Server Error\"\n}"}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233088
HelpLink: null
HttpStatusCode: InternalServerError
InnerException: null
IsHttpError: true
Message: "{\n \"message\": \"Server Error\"\n}"
Messages: null
Source: "SnipeSharp"
StackTrace: " bei SnipeSharp.RestClientManager.ExecuteRequest2[R](RestRequest request)\r\n bei SnipeSharp.RestClientManager.Post[T,R](String path, T object)\r\n bei SnipeSharp.RestClientManager.Post[R](String path, R object)\r\n bei SnipeSharp.EndPoint.EndPoint`1.Create(T toCreate)\r\n bei SnipeITInv.MainWindow.<NewAsset>d__16.MoveNext() in C:\\Users\\014nr9999\\Documents\\Visual Studio 2015\\Projects\\SnipeITInv\\SnipeITInv\\MainWindow.xaml.cs: Zeile367"
TargetSite: {SnipeSharp.ApiOptionalResponse`1[SnipeSharp.Models.RequestResponse`1[R]] ExecuteRequest2[R](RestSharp.RestRequest)}
When i remove asset.PurchaseDate = purchasedate;, it works.
FieldConverter
into SerializeAs
and DeserializeAs
, so it's clear what does what where without having to look in the contract resolvers.User.Name
doesn't have a public setter.SnipeItApi
to add support for newer endpoints being added in snipe-it 5.0.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.