GET method is only sending sys_id of target record as response. how to get other fields in response.

Obito
Tera Expert

Hi all,

 

We have one import set API & when we call GET method, we only see sys_id with some other information in response. My requirement is to get some fields value from import set table in the response we get. How can I do that.

 

Thanks,

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @Obito 

 

Assuming that you want to fetch some fields from the import set table, you can use Table API on your Import set table. Please refer below screenshots where I have fetched field information from imp_computer import set table using Table API GET method :

 

AmitVerma_0-1705476717191.png

 

Response Received :

 

 

{
  "result": [
    {
      "sys_import_state_comment": "",
      "template_import_log": "",
      "sys_updated_on": "2024-01-17 07:27:30",
      "sys_class_name": "imp_computer",
      "cpu_count": "",
      "manufacturer": "",
      "sys_target_sys_id": {
        "link": "https://dev78505.service-now.com/api/now/table/cmdb_ci_computer/807c9f112f7ff9102b86d4a72799b61e",
        "value": "807c9f112f7ff9102b86d4a72799b61e"
      },
      "sys_id": "9d6c5f112f7ff9102b86d4a72799b66d",
      "sys_updated_by": "Amit.Verma",
      "sys_created_on": "2024-01-17 07:27:29",
      "cpu_type": "",
      "sys_import_set": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_import_set/f36c9f112f7ff9102b86d4a72799b61a",
        "value": "f36c9f112f7ff9102b86d4a72799b61a"
      },
      "operating_system": "",
      "sys_transform_map": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_transform_map/4e3548e2c0a80094002e0c1550d11a26",
        "value": "4e3548e2c0a80094002e0c1550d11a26"
      },
      "sys_created_by": "Amit.Verma",
      "ram": "",
      "sys_import_row": "0",
      "sys_row_error": "",
      "sys_target_table": "cmdb_ci_computer",
      "sys_mod_count": "1",
      "cpu_speed": "",
      "serial_number": "123",
      "import_set_run": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_import_set_run/087c9f112f7ff9102b86d4a72799b61b",
        "value": "087c9f112f7ff9102b86d4a72799b61b"
      },
      "model_id": "",
      "disk_space": "",
      "sys_tags": "",
      "sys_import_state": "inserted",
      "name": "abc"
    }
  ]
}

 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

It should be possible to get way more details. Question is: what have you setup? Can you share anything?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Amit Verma
Kilo Patron
Kilo Patron

Hi @Obito 

 

Assuming that you want to fetch some fields from the import set table, you can use Table API on your Import set table. Please refer below screenshots where I have fetched field information from imp_computer import set table using Table API GET method :

 

AmitVerma_0-1705476717191.png

 

Response Received :

 

 

{
  "result": [
    {
      "sys_import_state_comment": "",
      "template_import_log": "",
      "sys_updated_on": "2024-01-17 07:27:30",
      "sys_class_name": "imp_computer",
      "cpu_count": "",
      "manufacturer": "",
      "sys_target_sys_id": {
        "link": "https://dev78505.service-now.com/api/now/table/cmdb_ci_computer/807c9f112f7ff9102b86d4a72799b61e",
        "value": "807c9f112f7ff9102b86d4a72799b61e"
      },
      "sys_id": "9d6c5f112f7ff9102b86d4a72799b66d",
      "sys_updated_by": "Amit.Verma",
      "sys_created_on": "2024-01-17 07:27:29",
      "cpu_type": "",
      "sys_import_set": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_import_set/f36c9f112f7ff9102b86d4a72799b61a",
        "value": "f36c9f112f7ff9102b86d4a72799b61a"
      },
      "operating_system": "",
      "sys_transform_map": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_transform_map/4e3548e2c0a80094002e0c1550d11a26",
        "value": "4e3548e2c0a80094002e0c1550d11a26"
      },
      "sys_created_by": "Amit.Verma",
      "ram": "",
      "sys_import_row": "0",
      "sys_row_error": "",
      "sys_target_table": "cmdb_ci_computer",
      "sys_mod_count": "1",
      "cpu_speed": "",
      "serial_number": "123",
      "import_set_run": {
        "link": "https://dev78505.service-now.com/api/now/table/sys_import_set_run/087c9f112f7ff9102b86d4a72799b61b",
        "value": "087c9f112f7ff9102b86d4a72799b61b"
      },
      "model_id": "",
      "disk_space": "",
      "sys_tags": "",
      "sys_import_state": "inserted",
      "name": "abc"
    }
  ]
}

 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Obito 

 

https://www.servicenow.com/community/developer-forum/servicenow-integration-to-pull-the-data-from-on...

https://www.servicenow.com/community/developer-forum/request-data-from-another-servicenow-instance/m...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************