Question

API errors

  • 15 March 2024
  • 0 replies
  • 50 views

Hello, new user here. I’m trying to create an asset using the API reflecting what I enter manually. I’ve had success with some asset types, but when trying to create a hardware asset with the following (using postman), I get an error:

curl -v -u XXXXX:X -H "Content-Type: application/json" -X POST -d '{

  "name": "Dell 780",

  "asset_type_id": 13000264236,

  "asset_tag": "ASSET-9",

  "description": "13.3-inch (diagonal) LED-backlit glossy widescreen display,1440-by-900 resolution",

  "user_id": 13003603108,

  "type_fields": {

    "product_25": 13000041218,

    "asset_state_25": "In Use",

    "serial_number_25": "SW12131133"

  }

}

' 'https://XXXXX.freshservice.com/api/v2/assets'

 

Error

{

    "description": "Validation failed",

    "errors": [

        {

            "field": "product_25",

            "message": "Unexpected/invalid field in request",

            "code": "invalid_field"

        },

        {

            "field": "asset_state_25",

            "message": "Unexpected/invalid field in request",

            "code": "invalid_field"

        },

        {

            "field": "serial_number_25",

            "message": "Unexpected/invalid field in request",

            "code": "invalid_field"

        }

    ]

}

 

Removing the highlighted fields I get:

{

    "description": "Validation failed",

    "errors": [

        {

            "field": "asset_type_id",

            "message": "It should not be blank as this is a mandatory field",

            "code": "invalid_value"

        }

    ]

}

All help appreciated


0 replies

Join the Community or User Group to Participate in this Discussion

Reply