REST API not able to populate choice value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 04:12 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 04:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 06:57 AM
Hi,
It's possible to achieve same result by Table API, as we are getting by background script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 07:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 10:38 AM
...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.