- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2018 01:58 AM
I am using the REST API to get details of a CI instance :
Example https://dev20622.service-now.com/api/now/cmdb/instance/cmdb_ci_appl/82992eb60ad337024fbb6d06a866c636
In the response received I can see the link to the Maintenance Schedule for the CI, but when I query the Maintenance Schedule, I cannot seem to extract the start and end dates of the schedule. Can you please let me know how to go about getting all Maintenance windows associated with a CI using REST API?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 06:31 PM
Hi ,
I see in Table cmn_schedule_span Two Fields:
Name:- Actual Name of Schedule Window
Schedule- Name of Maintenance Schedule (Stored In this Table-cmn_schedule_maintenance)
Now Store the Name of Maintenance Schedule and do lookup in Table cmn_schedule_span based on this value.
You will get the name of Schedule Window and from here you can fetch the data for Start and End Date.
Attaching Screen shot for More Clarity.
Regards
RP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2018 09:57 AM
Hello,
You can dot walk rest APIs using the sysparm_fields parameter in the URL. I believe it cannot be done using the API explorer as URL cannot be modified. You need to specify all dot walked field at the end of URL eg:
https://<instance>.service-now.com/api/now/table/cmdb_ci_appl?sysparm_fields=maintenance_schedule.start_date,maintenance_schedule.end_date
Please see its documentation in the link: https://docs.servicenow.com/bundle/london-application-development/page/integrate/inbound-rest/concept/c_DotWalkingInRESTAPI.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2018 01:13 PM
Thank you very much for the response.
Using the approach suggested I could get the name and type details of the maintenance schedule, but not the start and end dates.
For instance, when I append
?sysparm_fields=maintenance_schedule.start_date,maintenance_schedule.end_date
to the request URL, I get an empty response. I can query name and type using the same approach
?sysparm_fields=maintenance_schedule.name,maintenance_schedule.type
Could you please let me know about the exact field names for the start/end dates of the maintenance schedule or other fields that would indicate if it repeats and such?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 01:05 AM
Hello,
Inorder to get the start and end dates, you need to make multiple rest calls as these values are available in a different related table of schedules.
Your first query should fetch the maintenance schedule which will return a Sys_ID.
?sysparm_fields=maintenance_schedule
The second query should be made of cmn_schedule_span table with your sysparm_query=sys_id=value_of maintenance_schedule returned from first query along with sysparm_fields as
?sysparm_fields=end_date_time, start_date_time
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2018 06:37 PM