ServiceNow - 获取所有记录 [英] ServiceNow - Getting all records
问题描述
在 ServiceNow 中,我可以获得在 SOAP
请求中最多只能包含 250 个记录。如何获取 全部 记录?
Web参考Url = https ://*****.service-now.com/rm_story.do?WSDL
代码:
var url =https://*****.service-now.com/rm_story.do?SOAP ;
var userName = *****;
var password = *****;
var proxy = new ServiceNow_rm_story
{
Url = url,
Credentials = new NetworkCredential(userName,password)
};
try
{
var objRecord = new Namespace.WebReference.getRecords
{
// filters ..
};
var recordResults = proxy.getRecords(objRecord);
}
catch(例外)
{
}
在 recordResults
中,我只获得 250 条记录。如何获取所有记录?
获取ServiceNow记录Powershell - 超过250个 p>
请注意,返回大量记录可能会影响响应的性能,并且使用偏移量批量处理查询可能更有效(即,获取1-100,然后101-200,...)。这可以通过使用排序顺序和偏移来实现。 ServiceNow REST Table API实际上返回来自Get请求的链接头,提供第一,下一和最后一组记录的链接,使得容易知道URL查询下一批记录。
请参阅: http://wiki.servicenow.com/index。 php?title = Table_API#方法
,并在响应头下查看。
In ServiceNow, I am able to get only a maximum of 250 records in a SOAP
request. How to get all the records?
Web Reference Url = https://*****.service-now.com/rm_story.do?WSDL
Code:
var url = "https://*****.service-now.com/rm_story.do?SOAP";
var userName = *****;
var password = *****;
var proxy = new ServiceNow_rm_story
{
Url = url,
Credentials = new NetworkCredential(userName, password)
};
try
{
var objRecord = new Namespace.WebReference.getRecords
{
// filters..
};
var recordResults = proxy.getRecords(objRecord);
}
catch (Exception ex)
{
}
In recordResults
, I am getting only 250 records. How to get all the records ?
Also see this stack overflow answer which provides info. Get ServiceNow Records Powershell - More than 250
Note that returning a large number of records can affect performance of the response and it may be more efficient to process your query in batches using offsets (i.e., get 1-100, then 101-200, ...). This can be achieved by using a sort order and offset. The ServiceNow REST Table API actually returns link headers from Get requests providing you links for the first, next and last set of records making it easy to know the url to query the next batch of records.
See: http://wiki.servicenow.com/index.php?title=Table_API#Methods and look under 'Response Header'.
这篇关于ServiceNow - 获取所有记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!