-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v4.0.8
Feature type
Change to existing functionality
Proposed functionality
When uploading an image attachment via API, it should not require image_height and image_width fields. These should be calculated automatically, as they are when uploading using the GUI. Actually this already works, if you provide incorrect values (any integer) they will be ignored, and Netbox figures out the correct dimensions.
As an example, I'd like to use code like this:
files = { 'image': open(filename, 'rb') }
payload = {
'name': filename,
'object_id': 454,
'object_type': 'dcim.site'
}
url = f'{base_url}/api/extras/image-attachments/'
req = requests.post(url, headers=headers, files=files, data=payload)This currently fails with 400: {"image_height":["This field is required."],"image_width":["This field is required."]}
Use case
Calculating image dimensions requires extra work, and Netbox is already capable of doing this automatically, as it does when you upload using the GUI.
Database changes
none
External dependencies
No response
stavr666
Metadata
Metadata
Assignees
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application