Skip to content

{snipeit} cannot unmarshal hardware last_audit_date & next_audit_date #5

Description

@e-mar404

Code to reproduce:

package main

import (
	"github.com/joho/godotenv"
	"github.com/gemini-oss/rego/pkg/snipeit"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		panic(err)
	}

	_, clientErr := snipeit.NewClient(1).Assets().GetAllAssets()
	if clientErr != nil {
		panic(clientErr)
	}
}	

.env file

Using base url and token from snipe api reference examples.

Error gotten:

If asset has last_audit_date set I get this:

{snipeit} {assets.go:111} FATAL - Error fetching hardware list: unmarshalling error: json: cannot unmarshal object into Go struct field Hardware.rows.last_audit_date of type string

It also happens on next_audit_date

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions