Skip to content
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

API - extras/image-attachments - Filter by Device/Rack/Site/... #5072

Closed
Yentel opened this issue Aug 31, 2020 · 2 comments
Closed

API - extras/image-attachments - Filter by Device/Rack/Site/... #5072

Yentel opened this issue Aug 31, 2020 · 2 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@Yentel
Copy link

Yentel commented Aug 31, 2020

Environment

  • Python version: 3.7.3
  • NetBox version: 2.8.5

Proposed Functionality

As of now, using the api endpoint to retrieve images by device/site/rack is only possible by retrieving all image-attachments and then locally looping through them to find the required images. This is possible of course, but not scalable at all.
There is, according to the documentation, no possibility to filter this endpoint. The only two possible filters are limit and offset.

Another possibility is by adding a series of images to the respective parent objects (device,rack,site,...) themselves.

Use Case

Retrieving images for a certain object (device with id X, rack with id Y, site with id Z, ...)

Database Changes

None required as these objects are already linked to their models.

External Dependencies

None as far as I can think of.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation type: feature Introduction of new functionality to the application and removed status: accepted This issue has been accepted for implementation labels Aug 31, 2020
@jeremystretch
Copy link
Member

Related to #4897

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Sep 2, 2020
@jeremystretch jeremystretch self-assigned this Sep 2, 2020
@Yentel
Copy link
Author

Yentel commented Nov 22, 2020

Is there a possibility that this has not been resolved by this commit?

GET https://netbox.mycompany.com/api/extras/image-attachments/?content_type=dcim.device&object_id=2250 resulted in a 400 Bad Request response: {"content_type":["Select a valid choice. That choice is not one of the available choices."]}

However, when requesting the list option (/extras/image-attachments/), I get the object returned for which I'm looking.

{
        "id": 10,
        "url": "http://netbox.mycompany.com/api/extras/image-attachments/10/",
        "content_type": "dcim.device",
        "object_id": 2250,
        "parent": {
                "id": 2250,
                "url": "http://netbox.mycompany.com/api/dcim/devices/2250/",
                "name": "ROUTER",
                "display_name": "ROUTER"
        },
        "name": "",
        "image": "http://netbox.mycompany.com/media/image-attachments/device_2250_image33.jpg",
        "image_height": 1155,
        "image_width": 1540,
        "created": "2020-08-06T09:23:13.870529+02:00"
}

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

2 participants