Exception thrown after updating custom field via API #991

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

Originally created by @patrickfish on GitHub (May 24, 2017).

Issue type: Bug report

Python version: 2.7.9
NetBox version: 2.0.3

  1. Create custom field (I used a boolean) tied to dcim > site
  2. Do a PUT/POST against a site writing to that custom field, example:
{
  "name": "206",
  "slug": "206",
  "custom_fields":{"anira_ready":true}
}
  1. Attempt to load the site via web browser: $netbox/dcim/sites/206/

Error is:

<type 'exceptions.ValueError'>

invalid literal for int() with base 10: 'True'
Originally created by @patrickfish on GitHub (May 24, 2017). <!-- Please note: GitHub issues are to be used only for feature requests and bug reports. For installation assistance or general discussion, please join us on the mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please indicate "bug report" or "feature request" below. Be sure to search the existing set of issues (both open and closed) to see if a similar issue has already been raised. --> ### Issue type: Bug report <!-- If filing a bug, please indicate the version of Python and NetBox you are running. (This is not necessary for feature requests.) --> **Python version:** 2.7.9 **NetBox version:** 2.0.3 <!-- If filing a bug, please record the exact steps taken to reproduce the bug and any errors messages that are generated. If filing a feature request, please precisely describe the data model or workflow you would like to see implemented, and provide a use case. --> 1. Create custom field (I used a boolean) tied to dcim > site 2. Do a PUT/POST against a site writing to that custom field, example: ``` { "name": "206", "slug": "206", "custom_fields":{"anira_ready":true} } ``` 3. Attempt to load the site via web browser: $netbox/dcim/sites/206/ Error is: ``` <type 'exceptions.ValueError'> invalid literal for int() with base 10: 'True' ```
adam added the type: bug label 2025-12-29 16:27:38 +01:00
adam closed this issue 2025-12-29 16:27:38 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 31, 2017):

This is happening because custom field values are not being properly serialized when entered via the API.

@jeremystretch commented on GitHub (May 31, 2017): This is happening because custom field values are not being properly serialized when entered via the API.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#991