Extend REST API documentation with an example of uploading an image attachment using curl #10131

Closed
opened 2025-12-29 21:27:15 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Aug 22, 2024).

Originally assigned to: @jeremystretch on GitHub.

Change Type

Addition

Area

Integrations/API

Proposed Changes

The process for uploading files via the REST API differs a bit from regular JSON data. A simple copy-and-paste example using curl would be helpful for reference and troubleshooting. For example:

curl -X POST \
-H "Authorization: Token $TOKEN" \
-F "object_type=dcim.site" \
-F "object_id=2" \
-F "name=attachment1.png" \
-F "image=@image.png" \
http://netbox:8000/api/extras/image-attachments/
Originally created by @jeremystretch on GitHub (Aug 22, 2024). Originally assigned to: @jeremystretch on GitHub. ### Change Type Addition ### Area Integrations/API ### Proposed Changes The process for uploading files via the REST API differs a bit from regular JSON data. A simple copy-and-paste example using `curl` would be helpful for reference and troubleshooting. For example: ``` curl -X POST \ -H "Authorization: Token $TOKEN" \ -F "object_type=dcim.site" \ -F "object_id=2" \ -F "name=attachment1.png" \ -F "image=@image.png" \ http://netbox:8000/api/extras/image-attachments/ ```
adam added the status: acceptedtype: documentationnetbox labels 2025-12-29 21:27:15 +01:00
adam closed this issue 2025-12-29 21:27:15 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Apr 25, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Apr 25, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10131