Appendix: ServiceNow Change Request API Endpoints

This appendix describes the customized ServiceNow API Endpoints that were created for the ServiceNow Change Management SyncPack. These scripted endpoints reduce the amount of REST calls that PowerFlow makes to ServiceNow.

Please note that for pagination, the following Query parameters are not required: sysparm_offset and sysparm_limit. The default settings are:

  • sysparm_offset=0
  • sysparm_limit = ServiceNow defines the default upper limits for data export. It will check the following properties at System Properties > Import Export: glide.json.export.limit, glide.ui.export.limit, and then glide.ui.export.war.threshold.

For example, if you have 200 total records and you want to pull the records in 100-record chunks, then the first pull would be sysparm_offset=0 & sysparm_limit=100 and the second pull would be sysparm_offset=100 & sysparm_limit=100. For more information, see the ServiceNow documentation for Export Limits.

Change Requests

HTTP Method

GET

Resource Path

/api/x_sclo_scilogic/v2/sciencelogic/change_requests?record_type=change_request&state=1&region=ScienceLogic

Pagination

Enabled

Overview

This scripted API was built for pulling Change Requests or Change Tasks and formatting a JSON object response with the required information to create a maintenance schedule in SL1. The GET queries the task_ci table to find configuration items that are monitored by SL1 and are the correct record type. The GET will only pull Change Requests and Change Tasks that are in the future.

Headers
Key Value

Content-Type

application/json

Accept

application/json

Parameters

Key Value

record_type (required)

change_request

state

-5

region (required)

ScienceLogic

sysparm_offset

0

sysparm_limit

glide.json.export.limit, glide.ui.export.limit, glide.ui.export.war.threshold

HTTP Status

Code

Value

200

OK

400

Query parameter \'region\' or \'record_type\' is not defined and is required.

Example (Request URL)

https://<your Instance>.service-now.com/api/x_sclo_scilogic/v2/sciencelogic/change_requests?record_type=change_request&state=-2®ion=ven70_sl151_pf199&sysparm_offset=1&sysparm_limit=1

Examples (Response)

Change Request:

{
   "results": [
        {
            "sys_id": "129994931bf91110f219866fdc4bcbb6",
            "number": "CHG0030115",
            "type": "Normal",
            "state_value": "-2",
            "state": "Scheduled",
            "short_description": "Firmware upgrade Printer (x8)",
            "planned_start_date": "2022-09-30 17:00:00",
            "planned_end_date": "2022-09-30 17:30:00",
            "device": [
                {
                    "sys_id": "75febcd21b3d99106af3dac4bd4bcb95",
                    "name": "Printer: SIM-0019004",
                    "class": "cmdb_ci_printer",
                    "id": "488",
                    "region": "ven70_sl151_pf199"
                 }
            ]
       }
   ],
   "sysparm_offset": 0,
   "sysparm_limit": 1,
   "return_count": 1,
   "total_count": 2
}

Change Task:

{
   "results": [
       {
           "sys_id": "af2554eb1b7d5110f219866fdc4bcbcd",
           "number": "CTASK0010073",
           "state_value": "1",
           "state": "Open",
           "short_description": "firmware upgrade",
           "planned_start_date": "2022-10-01 14:30:00",
           "planned_end_date": "2022-10-01 15:00:00",
           "device": [
               {
                  "sys_id": "01fef8d21b3d99106af3dac4bd4bcb1f",
                  "name": "IP Router: SIM-0019217",
                  "class": "cmdb_ci_ip_router",
                  "id": "439",
                  "region": "ven70_sl151_pf199"
               }
           ]
       }
   ],
   "sysparm_offset": 0,
   "sysparm_limit": 1,
   "return_count": 1,
   "total_count": 1
}