ASN API does not save Sites provided in the payload #11810

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

Originally created by @sawan on GitHub (Nov 6, 2025).

NetBox Edition

NetBox Community

NetBox Version

v4.4.5

Python Version

3.10

Steps to Reproduce

The ASN model has an option to assign to multiple Sites. This works in the Netbox UI but not over the API.

curl -X 'POST' \
  'https://demo.netbox.dev/api/ipam/asns/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token c826403b85fa2a1b47cb5468895806f186e52fd0' \
  -H 'Content-Type: application/json' \
  -d '{
  "asn": 64523,
  "rir": {
    "slug": "rfc-1918"
  },
  "sites": [
   { "slug": "austin-lab" }
  ]
}'

Expected Behavior

ASN should have Site(s) associated with them.

If this is not supported the Sites should not be accepted in the payload.

Observed Behavior

ASN is created but no Site is assigned.

API returns 200.

Originally created by @sawan on GitHub (Nov 6, 2025). ### NetBox Edition NetBox Community ### NetBox Version v4.4.5 ### Python Version 3.10 ### Steps to Reproduce The ASN model has an option to assign to multiple Sites. This works in the Netbox UI but not over the API. ```bash curl -X 'POST' \ 'https://demo.netbox.dev/api/ipam/asns/' \ -H 'accept: application/json' \ -H 'Authorization: Token c826403b85fa2a1b47cb5468895806f186e52fd0' \ -H 'Content-Type: application/json' \ -d '{ "asn": 64523, "rir": { "slug": "rfc-1918" }, "sites": [ { "slug": "austin-lab" } ] }' ``` ### Expected Behavior ASN should have Site(s) associated with them. If this is not supported the Sites should not be accepted in the payload. ### Observed Behavior ASN is created but no Site is assigned. API returns 200.
adam added the netbox label 2025-12-29 21:50:09 +01:00
adam closed this issue 2025-12-29 21:50:10 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 6, 2025):

The REST API serializer for ASNs has no sites field: ASN assignment must be set on the site itself. Please be sure to check the REST API documentation before submitting bug reports.

@jeremystretch commented on GitHub (Nov 6, 2025): The REST API serializer for ASNs has no `sites` field: ASN assignment must be set on the site itself. Please be sure to check the REST API documentation before submitting bug reports.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11810