Replies: 2 comments 6 replies
-
From which previous version? |
Beta Was this translation helpful? Give feedback.
4 replies
-
If you are setting or removing related values (eg. tags) isn't that just an array of id number or name strings and not a hash with all the field values like is returned
eg. "tags": [1, 7]
or "tags": ["foo", "bar"]
not "tags": [{"name": "foo", "id": 1},{"name": "bar", "id": 7}]
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: eskdera ***@***.***>
Sent: Tuesday, November 22, 2022 8:56 AM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [netbox-community/netbox] API | Having syntax issues when adding tags on records (v3.3.8) (Discussion #10978)
@candlerb<https://github.com/candlerb> The issue must be with the way data is being passed to tags because when I remove "tags": [ {"name": "test","slug": "test" }] from the request it works with no errors (I tested the request in postman as well same deal) with tags in the request I get the following exception.
`
The complete exception is provided below:
<class 'ValueError'>
Cannot add ['test'] (<class 'list'>). Expected <class 'django.db.models.base.ModelBase'> or str.
Python version: 3.9.6
NetBox version: 3.3.8
`
And I'm using POST since I want to create a new tenant.
—
Reply to this email directly, view it on GitHub<#10978 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM2LAHDNJTORC5AS5VDWJTNJJANCNFSM6AAAAAASEW5JME>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, we have recently upgraded our netbox to v3.3.8 and the previous syntax for adding tags to a (tenant) record through a post request doesn't work anymore. this used to work before (per https://demo.netbox.dev/api/docs/):
var body = JSON.stringify({ 'name': 'name', 'slug': 'slug', 'tags': [ { "name": "slug", "slug": "slug"}] });
I've tried other syntaxes as well but had no luck adding a tag while adding a tenant record through the API.
I get this error:
Cannot add ['tag'] (<class 'list'>). Expected <class 'django.db.models.base.ModelBase'> or str.\n\nPython version: 3.9.6\nNetBox version: 3.3.8</pre>
I appreciate the help.
Beta Was this translation helpful? Give feedback.
All reactions