-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Checkout an Asset #7
Comments
Hi Mark. Did you ever figure out the trick to checking out an asset to a location? James |
This is probably a problem in my code. The checkout to location was added after my last update to SnipeSharp. I'll try to dig into it and fix soon. I've been heavily tied up with work the last few months. |
Thank Barry. I know how the 9-5 can go.... It's about the same for me. Passion projects are hard to work on after 10 to 12 hours of staring at a computer and holding user's hands..... Then get home and do it some more. If it helps here is where I am: This is the code I am using to setup the checkout:
Now if I call: Here are the details of the error: dictionary = {{ "id": 3, "name": "Test2", "asset_tag": "01003", "model_id": 2, "serial": null, "purchase_date": null, "purchase_cost": null, "order_number": null, "assigned_to": 2, "notes": null, "image": null, "user_id": 1, "created_at": "2018-07-04 11:37:13", "updated_at": "2018-07-05 07:59:35", "physical": 1, "deleted_at": null, "status_id": 2, "archived": 0, "warranty_months": null, "depreciate": 0, "supplier_id": null, "requestable": 0, "rtd_location_id": null, "_snipeit_ethernet_mac_address_1": "01:23:45:67:89:ab", "accepted": null, "last_checkout": "2018-07-05 07:59:35", "expected_checkin": null, "company_id": 0, "assigned_type": "App\Models\Location", "last_audit_date": null, "next_audit_date": null, "location_id": 2, "checkin_counter": 4, "checkout_counter": 7, "requests_counter": 0, "_snipeit_funding_source_2": "", "_snipeit_wireless_mac_address_3": "", "assigned": { "id": 2, "name": "Kitchen", "city": "", "state": "", "country": "", "created_at": "2018-07-03 22:50:20", "updated_at": "2018-07-03 22:50:20", "address": "", "address2": "", "zip": "", "deleted_at": null, "parent_id": 1, "currency": "", "ldap_ou": null, "manager_id": 0, "image": null }}} item= {{ "id": 3, "name": "Test2", "asset_tag": "01003", "model_id": 2, "serial": null, "purchase_date": null, "purchase_cost": null, "order_number": null, "assigned_to": 2, "notes": null, "image": null, "user_id": 1, "created_at": "2018-07-04 11:37:13", "updated_at": "2018-07-05 07:59:35", "physical": 1, "deleted_at": null, "status_id": 2, "archived": 0, "warranty_months": null, "depreciate": 0, "supplier_id": null, "requestable": 0, "rtd_location_id": null, "_snipeit_ethernet_mac_address_1": "01:23:45:67:89:ab", "accepted": null, "last_checkout": "2018-07-05 07:59:35", "expected_checkin": null, "company_id": 0, "assigned_type": "App\Models\Location", "last_audit_date": null, "next_audit_date": null, "location_id": 2, "checkin_counter": 4, "checkout_counter": 7, "requests_counter": 0, "_snipeit_funding_source_2": "", "_snipeit_wireless_mac_address_3": "", "assigned": { "id": 2, "name": "Kitchen", "city": "", "state": "", "country": "", "created_at": "2018-07-03 22:50:20", "updated_at": "2018-07-03 22:50:20", "address": "", "address2": "", "zip": "", "deleted_at": null, "parent_id": 1, "currency": "", "ldap_ou": null, "manager_id": 0, "image": null }}} If I press continue I get the same error message in EndPointManager.cs at line 150. I have not had a chance to trace back the wrapper to see why it is throwing that error - I suspect it is because I am using the update function to checkout an asset instead of using the checkout function. If there is anything you would like me to try or anyway I can help, please let me know. Thanks, |
I'm not checking out to a location, but to a user. I abandoned the above method, and called the snipe.AssetManager.Checkout function instead, but I found that the AssetCheckoutRequest had a problem.
.. so that I didn't have to provide a name. Then used this to checkout the asset.
Hope that makes sense. |
Hey, thanks for the info. I just tested this out and it actually works as is. The below code checks out the asset to the proper user.
If you save the result of .Checkout to a variable you can check the status, either error or success along with the message. However, the error you getting when calling update does appear to be a bug. It breaks the JSON converter when their is an checkout request attached. Working on that one now. Trying to wrap my head back around the code, hardly remember how it works. |
Hi Barry. Finally got some time to work on this again. Thanks for your code, I see what I was doing wrong now. When I was setting the CheckoutToType, I was setting it to "Location". Changing the type to "location" (lower case L) did the trick. Had I check the error message I think it would have pointed my in the right direction. Thanks, |
Hi guys, I've added the asset and tried to check it out to a location with the folllowing code:
This results in an error that says that an attribute field is required if none of the following values are set. But there is no name of an attribute nor any value.
Any ideas? Best regards, Tom |
Hi
I'm trying to checkout an Asset to a user, but can't work out the correct procedure.
I have successfully found both the Asset and the User using UserManager.FindAll and AssetManager.FindAll, but am struggling to Checkout the asset to the user.
This is what I have tried...
After this,
x
contains "success", buty
is an error...{[assigned_user, The assigned user field is required when none of assigned asset / assigned location are present.]} {[assigned_asset, The assigned asset field is required when none of assigned user / assigned location are present.]} {[assigned_location, The assigned location field is required when none of assigned user / assigned asset are present.]} {[checkout_to_type, The checkout to type field is required.]}
In the apache logs I can see that the checkout request has been received by the snipeit server, so I'm guessing I'm not preparing the request properly.
I'm also not sure if I should be Updating the asset before checking out
Any help would be appreciated.
Thanks in advance
Mark.
The text was updated successfully, but these errors were encountered: