The Zurich release has arrived! Interested in new features and functionalities? Click here for more

No transform entry or scripts are defined through scripted REST API

Mike Hashemi
Kilo Sage

I am trying to create a scripted API that will accept some JSON data and put it in the cmdb_ci_computer table through an import set. Here are the steps I have taken:

  1. Extend the Import Set row table
    1. Label: logicmonitor_rest_api_device
    2. Name: u_logicmonitor_rest_api_device
    3. Columns: displayName (string), lmDeviceId (integer), name (string)
  2. Extended the cmdb_ci_computer class to cmdb_ci_computer_api_test
    1. Added the display name and LM device ID columns (I also added a second "name" column by mistake)
  3. Created a table transform map
    1. Source table: u_logicmonitor_rest_api_device
    2. Target table: cmdb_ci_computer_api_test
    3. Field maps: u_name = u_name, u_lmdeviceid = u_lm_device_id, u_name = name, and u_displayname = u_displayname
  4. Created a script include, which should be inserting into the u_logicmonitor_rest_api_device table (see attached scriptInclude.txt)
  5. Created a scripted REST resource which calls the script include (see attached rest.txt)

When I call the API, I get back:

{
"http_status": "500",
"status_message": "Unexpected import result during device transform. The import state is: error. The error message is: No transform entry or scripts are defined. And error code is: . ID of import set row is: undefined. The JSON looks like: {\"id\":18,\"name\":\"10.0.0.1\",\"displayName\":\"server1.domain.tld\"}"
}

 

This is the transform map (I blocked out the target table because I changed the table name between the screenshot and this post).

MikeHashemi_0-1679608563338.png

 

This is what I see in the import set. The Transform Map was blank for the top row, so I changed it, saved, and sent a POST to the API again. The second row was created and the top one never finishes:

MikeHashemi_1-1679608747540.png

 

What am I missing here?

 

0 REPLIES 0