I'm trying to get data using php code that is displayed as example on "https://snipe-it.readme.io/reference#hardware-list", I replaced the "server" to my server name, and access token, when a run this piece of code I get 0 assets as result.
My purpose it is get data about assets and users from database do use in a application that I'm developing (C#), that application will generate a statement of responsibility to each asset that we checked out as the company where I work requires.
There is a way to retrieve that data using slq queries?
Is there a way to do with C# or I really need use that piece of code in php?
I'm open to any solution that you have.
The result is "There are 0 assets"
Is this a fresh install or an upgrade?
Version of Snipe-IT you're running
Hosted version.
Version of PHP you're running
php7.1.9
Version of MySQL/MariaDB you're running
What OS and web server you're running Snipe-IT on
Windows 10
What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
Hosted version.
WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error
If a stacktrace is provided in the error, include that too.
Any errors that appear in your browser's error console.
Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
Include any additional information you can find in app/storage/logs and your webserver's logs.
Include what you've done so far in the installation, and if you got any error messages along the way.
Indicate whether or not you've manually edited any data directly in the database
Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.
Hi Nathan (again) :)
When you try the curl example via your local command line (again, replacing the YOUR-API-TOKEN bit with your own API token, does it give you any results?
(Also, I can't tell from your initial issue, but if you're a hosted customer, let me know and I'll hit you up on the private helpdesk so we can try to work with you more directly.)
Hi,
I'am a hosted customer but If you want to solve the problem here, I do not care, we can solve wherever you think best.
I tried the curl example on cmd in windows and I get results without problem.
If I try adapt the curl code to C# I will get results. You think that is a good idea?
thanks.
@nathanysp Heh, well, I'm afraid it's been a little too long since I've built anything in C# for me to be helpful with specifics on that. I do know that one of our users created a C# wrapper that might be useful to you, either to use directly or to use as an example: https://github.com/barrycarey/SnipeSharp
All we're really doing here is a REST API, so whatever way C# best handles REST, that's probably what you want. I'm sorry I can't be more useful here - I'm suuuuuper rusty in C# :(
Also, @barrycarey might have some insight if his library alone isn't helping.
The good news is that since you can cURL it, your API key is okay and the connections are all working, so it shouldn't be too much harder to figure out what else you might need to pass or parse to get it working.
Also - does the statement of responsibility happen at a separate time than the actual checkout? We do allow for digital signatures with asset acceptance, I'm not sure if you explored that at all. Enabling that plus a EULA (it doesn't have to be a EULA exactly, just some set of terms you want your user to agree to) might work.
Thank you very much for the really quick answer, I will look out at barrycarey's code and figure out how to adapt to my case, I was afraid that the connection wasn't working, since the curl test worked fine, no problem here. :)
We are performing some tests on digital signatures with asset acceptance, and we found this very interesting, we gonna start to using for sure!! One last question, there is some place where the signature gets stored? I look around on snipe it and I didn't found it.
And again, Thank you so much. 馃憤馃
@nathanysp I second @snipe suggestion to look a barrycarry's code. If you have an idea what you are wanting you can have a look at my project https://github.com/fordster78/SnipeitAgent
This queries the hardware of the system and then adds it to snipe through the api using BarryCarry's project.
I am looking into improving this and turning it into a service. Any suggestions or improvement would help massively.
Thanks
Hi @nathanysp
One last question, there is some place where the signature gets stored?
Yep! In the asset history tab, you'll see the signature along with the timestamp of when they accepted it. (That column will only show if you have that feature enabled in the Settings though - and it's hidden by default, so you'll need to use the column-selector in the table to see it.)
Thank you very much @snipe I found it. 馃
Thank you @fordster78 for the tip. 馃憤
@nathanysp I'm just using RestSharp in my wrapper to make requests to the API. It's pretty simple to do.
``
Client = new RestClient()
Client.AddDefaultHeader("Accept", "application/json");
Client.Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(APITOKEN, "Bearer");
Client.BaseUrl = http://address.com/;
RestRequest req = new RestRequest();
req.Resource('hardware');
IRestResponse res = Client.Execute(req);
``
You can then parse the response JSON with Json.net
@nathanysp I'm going to close this ticket for now, but definitely open a new one if you run into additional issues :)