Creating an asset Via API - failed

I am trying to create a new Asset using this method (POST):

This is the body request:

{'name': 'MONITOR Color LCD', 'description': 'INFO: 2017\nSN: NULL\nWIFI: Partner_C97787_5)Date: 2022-03-09 19:48:16', 'user_id': 110023536373, 'asset_type_id': 110030801420}

According to the API Doc, it includes all the needed fields ( Service Desk API for Developers | Freshservice)

However, once posted it failed with the following errors:

Validation failed
[{'field': 'product_11000801411', 'message': 'This field cannot be empty', 'code': 'missing_field'}, {'field': 'asset_state_11000801411', 'message': 'This field cannot be empty', 'code': 'missing_field'}]

These fields are not mentioned in the API Document.

Any idea how to solve it?

Hi Haim Ziv

Welcome to the freshworks developer community!

I haven’t used the assets API much but on playing around to solve this I have a few suggestions

  • Apart from the mandatory fields that are given for the create asset API you might also have to send the mandatory fields needed for that particular asset type

  • To get the list of mandatory asset type fields for your asset type try this


    Sample response

          "asset_type_fields": [
                  "field_header": "test",
                  "fields": [
                          "id": 1073433815,
                          "created_at": "2022-03-13T16:06:30Z",
                          "updated_at": "2022-03-13T16:06:30Z",
                          "asset_type_id": 1024908431,
                          "name": "testing_required_1024908431",
                          "label": "testing_required",
                          "required": true,
                          "is_unique": false,
                          "field_type": "text",
                          "data_type": "string",
                          "default_field": false

    In the response look for your asset type’s name in the “field_header” key and check the fields listed for it ( specifically the required attribute for each field ) and make sure that you are passing the values for all the required fields while creating an asset of this type.

    Note - Mostly the name of all the fields would be the name that you gave while creating the field_<asset_type_id>

Hope this helps you out, if not please let us know :slightly_smiling_face:

1 Like

The URL you posted in your offer to help fails.
Sorry to say, absolutely typical of FreshDesk support.

And (to freshservice) what about actually having documentation that works? Mandatory field list that doesn’t work, on several of the APIs.

Hello @DisconentFSuser

I appreciate that you are going through a frustrating experience navigating our API resources for Freshservice. I also appreciate that there are improvements we could make to our resources to reflect more accurately how they might behave today. Your feedback on that front would be sincerely appreciated.

In the context of the current post, do you mind highlighting what URL fails? Do you also mind expanding on how exactly it fails for you? I would like to believe that what @banu tried when she posted this was working for her.