Skip to content

Netbox tag requiring tagged_items on unmarshal while the API doesn't return that information #205

Closed
@greatman

Description

@greatman

Hello!

https://github.com/netbox-community/go-netbox/blob/master/model_tag.go#L478

The UnmarshalJSON method requires the tagged_items property in the JSON from netbox. When creating an object, that field is not shown:

{
  "id" : 10,
  "url" : "http://localhost:8001/api/extras/tags/10/",
  "display_url" : "http://localhost:8001/extras/tags/10/",
  "display" : "test-tag_basic-vu6hw8lmkf",
  "name" : "test-tag_basic-vu6hw8lmkf",
  "slug" : "test-tag_basic-2xheda2ay7",
  "color" : "112233",
  "description" : "This is a test",
  "object_types" : [ ],
  "created" : "2025-02-27T15:00:25.402848Z",
  "last_updated" : "2025-02-27T15:00:25.402859Z"
}

I used the following to create a tag:

api_res, _, err := client.ExtrasAPI.
		ExtrasTagsCreate(ctx).
		TagRequest(*tagRequest).Execute()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions