REST API not able to populate choice value

Sanjeev Kumar1
Kilo Sage

Hi All,

I am using REST API to insert/update data in Windows Server (cmdb_ci_win_server).

In Opertaion system (os) column if API found existing value it is selected properly but if no matched value exist in system it will not updating value.

{
"name":"desktop-i1frftf-3",
"os":"Microsoft Windows 10 Home",
"operational_status":"1"
}

but if we run from background for update/insert, if os value does not exist in choice list it will inserted by script but it's showing in blue.

In this image first record is inserted by background Script. Second record inserted by REST API.

I hope REST API also insert data in system in same way as inserted by background Script.  

find_real_file.png 

10 REPLIES 10

ARG645
Tera Guru
Hello, This is an expected behaviour with Table API i guess. To have better control over your data population in your table, try using Import set API. Once you define your import set API and its transform map, you can specify a Choice Action as “Create” on your Operating System Column. Please Mark Answer as Helpful/Correct if Applicable.

Hi,

It's possible to achieve same result by Table API, as we are getting by background script.

  

I disagree

Background scripts and Table API are not the same.

I just ran a test in my SandBox. Table API doest create new choices , but skips them. You get a Blue color value in the choice field because its new value and you are forcing it via background script. 

Choice field value in Blue Color 

As my first response suggested, better to use Import set API and Transform map. 

-Aman Gurram

...this expected behavior is just bad design. Purpose of the REST API is to allow fields to be updated from external sources. Its up to the system using the API's to ensure they are pushing valid data.