You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently updated netbox to v2.9.8 and one of our scripts broke because there apparently the api changed and contains now a new resource specifically for tags:
POST /api/tenancy/tenants/?format=json HTTP/1.1
Host: netbox
Authorization: token myTokenString
User-Agent: PowerShell
Content-Type: application/json
Connection: close
{"slug":"BAR111","tags":["MyTagName"],"custom_fields":{"customer_id":"111"},"group":1,"name":"Bar111"}
Error response:
HTTP/1.1 400 Bad Request
Date: Sat, 05 Dec 2020 04:08:45 GMT
Content-Type: application/json
Connection: close
Server: gunicorn/20.0.4
Vary: Accept, Cookie, Origin
Allow: GET, POST, HEAD, OPTIONS
API-Version: 2.9
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
X-Frame-Options: SAMEORIGIN
{"tags":[["Related objects must be referenced by numeric ID or by dictionary of attributes. Received an unrecognized value: MyTagName"]]}
new:
POST /api/tenancy/tenants/?format=json HTTP/1.1
Host: netbox
Authorization: token myTokenString
User-Agent: PowerShell
Content-Type: application/json
Connection: close
{"slug":"BAR111","tags":[92],"custom_fields":{"customer_id":"111"},"group":1,"name":"Bar111"}
The difference is that tags is now a int array instead of a string array. Where the provided number ("92") is the id of the tag resource. The swagger documentation of netbox is apparently incorrect on that part, as it says it's an array of objects with mandatory name and slug.
To get all tags and there id: Get-nbObject -APIUrl "https://netbox" -Resource "extras/tags" | ft
The text was updated successfully, but these errors were encountered:
We recently updated netbox to v2.9.8 and one of our scripts broke because there apparently the api changed and contains now a new resource specifically for tags:
Error response:
new:
The difference is that tags is now a int array instead of a string array. Where the provided number ("92") is the id of the tag resource. The swagger documentation of netbox is apparently incorrect on that part, as it says it's an array of objects with mandatory name and slug.
To get all tags and there id:
Get-nbObject -APIUrl "https://netbox" -Resource "extras/tags" | ft
The text was updated successfully, but these errors were encountered: