Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Send events via cURL

Log in to subscribe to topics and get notified when content changes.

Send events via cURL

You can use the cURL command-line tool to send multiple events to a ServiceNow instance.

Before you begin

For Mac, cURL is automatically available.

For Unix, Linux, or Windows, make sure that the cURL command-line tool is installed. You can download it at http://curl.haxx.se/download.html.

Role required: evt_mgmt_integration

Procedure

  1. Use a text editor to create a shell (.sh) file with event records.
    curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data "{
         \"records\":
         [
         {
         \"source\" : \"Simulated\", 
         \"node\" : \"nameofnode\" , 
         \"type\" : \"High Virtual Memory\",  
         \"resource\" : \"\", 
         \"severity\" : \"5\", 
         \"description\" : \"Virtual memory usage exceeds 98%\", 
         \"ci_type\":\"cmdb_ci_app_server_tomcat\", 
         \"additional_info\":\"{'name':'My Airlines'}\"
         },
         {
         \"source\" : \"Simulated\", 
         \"node\" : \"01.myairlines.com\" , 
         \"type\" : \"High CPU Utilization\",  
         \"resource\" : \"\", 
         \"severity\" : \"5\", 
         \"description\" : 
         \"CPU on 01.my.com at 60%\"
         }  
        ] 
         }" -u myUserID:myPassword "https://my-instance.service-now.com/em_event.do?JSONv2&sysparm_action=insertMultiple"
    
    
  2. Use the -H option. For the POST parameter, start the data block with an open bracket and delimit the data with backslashes. For example:
    POST --data "{\"records\":[{\"source\" :  [. . .]}"
    Table 1. Header parameters for use with -H option
    Parameter Type Description
    Accept String The acceptable type for this message.

    The default value is application/json.

    Content-Type String The content type for this message.

    The default value is application/json.

    POST String The request type is POST with one or more trailing records.
  3. Use the -u option and the instance URL with login credentials. For example:
     -u myUserID:myPassword "https://my-instance.service-now.com/em_event.do?
        JSONv2&sysparm_action=insertMultiple"
  4. Test the scripted integration.
Feedback