Skip to content

How to Checkout an Asset #7

@Mark-Clegg

Description

@Mark-Clegg

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...

Asset.CheckoutRequest = new SnipeSharp.Endpoints.EndpointHelpers.AssetCheckoutRequest
{
    CheckoutToType = "user",  // Is this correct?
    AssignedUser = User,
    Note = "Auto Checkout via Easy Assist"
};
var x = snipe.AssetManager.Update(Asset);
var y = snipe.AssetManager.Checkout(Asset);

After this, x contains "success", but y 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions