Global text search via api?

jsamm
Giga Contributor

Can you search all incident fields for keywords (full text search) via the rest api?   Is there another way to do full text search from outside servicenow?

1 ACCEPTED SOLUTION

Jace Benson
Mega Sage

I was just in a meeting with some folks from Service-Now about the needs I was having to do search.   There is no restful api to the global search.   They said they appreciated the feedback, but gave no details as what or when anything would be available.   With that being said the best you are going to get is to do keyword gliderecord calls.   However, that doesnt give you a way to order by best match.


View solution in original post

6 REPLIES 6

I've since found out you can do this.



Here's the call via CURL;



curl --request GET \


  --url 'https://.service-now.com/api/now/globalsearch/search?sysparm_search=test&sysparm_groups=8c58a5aa0a0a...' \


  --header 'accept: application/json' \


  --header 'authorization: Basic yourbasicauthstringhere' \


  --header 'content-type: application/json' \



sysparm_groups = sys_id of search group


sysparm_search = term your searching for.



Response looks like this;



{


      "result": {


              "groups": [{


                              "tables": [{


                                              "label": "Incident",


                                              "name": "incident",


                                              "id": "8c58db5d0a0a0b0701130dfff1fe4ee0",


                                              "filter": "",


                                              "condition_query": "",


                                              "label_plural": "Incidents"


                                      },


                                      {


                                              "label": "Change Request",


                                              "name": "change_request",


                                              "id": "8c58ef080a0a0b0700eb143ac2e5de7e",


                                              "filter": "Active = true",


                                              "condition_query": "\n\t\t\tactive=true^EQ\n\t\t\t",


                                              "label_plural": "Change Requests"


                                      },


                                      "description": "Search task records (Incidents, Change Requests, Problems, etc.)",


                                      "name": "Tasks",


                                      "id": "8c58a5aa0a0a0b07008047e8ef0fe07d",


                                      "result_count": 10363,


                                      "search_results": [{


                                              "stuff": "vals"


                                      }, {


                                              "stuff",


                                              "vals"


                                      }];


                              }


                      ]


              }


      }


klh
Mega Contributor

Fantastic, I have managed to get the api to return results from the search quite happily, now on to parsing and refining the data that it returns and what we can do to serialize it.