Skip to content

Accessories API - Can Checkout return the pivot ID, and Checkin log target be set to checked-out user #9978

@ntbutler87

Description

@ntbutler87

Expected Behavior (or desired behavior if a feature request)

When checking out an accessory to someone via the API, it would be really helpful for the JSON response to include the associated pivot ID so we don't have to query the checkedout endpoint and filter through that before being able to check in the asset. Something like:

{
  "status": "success",
  "messages": "Accessory checked in successfully.",
  "payload": null,
  "pivot_id": 273
}

And when checking in the accessory via the checkin API, the "Target" user that appears on the recent activity logs is the admin user of the API token, not the user that the accessory was checked in from. It would make sense in my mind that it should be the user who had borrowed the accessory.


Actual Behavior

JSON response from the accessories checkout endpoint gives no information about the pivot ID, so it needs to be retrieved and filtered out from the checkedout endpoint endpoint:

{
  "status": "success",
  "messages": "Accessory checked in successfully.",
  "payload": null
}

When checking in the accessory via the checkin API, the "Target" user that appears on the recent activity logs is the admin user of the API token, not the user that the accessory was checked in from.


Please confirm you have done the following before posting your bug report:


Provide answers to these questions:

  • Is this a fresh install or an upgrade? No - production instance that's recently been updated from version 4
  • Version of Snipe-IT you're running - v5.1.8 build 6227 (g6b7d5ed5a)
  • Version of PHP you're running - 7.3.13
  • Version of MySQL/MariaDB you're running - MYSQL 8.0.13
  • What OS and web server you're running Snipe-IT on - Windows IIS
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - Git
  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error - N/A
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error - Accessories API endpoint
  • If a stacktrace is provided in the error, include that too. - N/A
  • Any errors that appear in your browser's error console. - N/A
  • Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo. - Yes
  • Include any additional information you can find in storage/logs and your webserver's logs. - N/A
  • 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 - No

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.

https://snipe-it.readme.io/docs/getting-help

Metadata

Metadata

Assignees

No one assigned

    Labels

    👩‍💻 ready for devThese issues are ready for someone to work on them - take your pick!api

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions