Code Monkey home page Code Monkey logo

snipesharp's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

snipesharp's Issues

Deserialization error when updating assigned asset

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.

Set PurchaseDate failed

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.

Plan for Completion

  • Split FieldConverter into SerializeAs and DeserializeAs, so it's clear what does what where without having to look in the contract resolvers.
  • Go over all the models and make sure they match what's received from the transformers in snipe-it.
  • Refactor CommonEndPointModel and friends again slightly
    • User.Name doesn't have a public setter. Unfortunately, this is not possible.
  • Finish response scraping script.
    • Scrape responses.
    • Write tests for scraped responses.
  • Add tests for the PowerShell module.
  • Get a new name for the project (suggestions welcome!) so we can publish on Nuget. I don't think barrycarey's version is going to be updated anytime soon.
  • See about having different versions of the SnipeItApi to add support for newer endpoints being added in snipe-it 5.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.