成功因素API限制每个请求返回的记录数

时间:2018-09-06 23:25:35

标签: python rest api sap-successfactors

我正在使用python从Successfactor API检索数据。一个实体如此繁重,以至于每个请求默认返回1000条记录总是导致服务器超时。

我想减少每个请求返回的记录数,以避免服务器出现超时问题。

我尝试过$ top = 100 ...但不能移到下一个100,因为返回的结果中没有__next链接,也没有$ offset选项。

我试图限制返回nonNavigationProperties的列数。仍然没有帮助。

有人知道如何解决吗?

下面是一个示例:

https://xxxx.successfactors.com/odata/v2/JobRequisition?$ format = JSON && $ filter = lastModifiedDateTime ge datetime'2015-08-27T00:00:00'和lastModifiedDateTime le datetime'2015-08-27T23:59:59'&$ select = age ,appTemplateId,assessRatingScaleName,cReq1UpApprover,cReqAddSourcing,cReqAdvertCost,cReqAdvertDetails,cReqAdvertDraftCopy,cReqAlternateLocation,cReqAppID,cReqAssignmentValue,cReqAward,cReqCancelCost,cReqCancelReason,cReqCancelbyELT,cReqChangetoterms,cReqChargeRate,cReqCompany,cReqContractDuration,cReqCoreSourcing,cReqCurrentEndDate,cReqDateShortlist,cReqDescServices,cReqEstAgencyCost,cReqEstCostOfHire,cReqExtensionEndDate ,cReqExtensionStartDate,cReqFirstName,cReqFlexiWork,cReqHMPositionTitle,cReqHSE,cReqHiringManagerComments,cReqHoursPerWeek,cReqInt1Req,cReqJBComments,cReqLastName,cReqLimitedTermDuration,cReqLinkedInProject,cReqMarketMapInfo,cReqMaxRate,cReqNewDate,cReqOfferTarget,cReqOriginalREQID,cReqOriginalStartDate,cReqPOApprover1,cReqPOApprover2,cReqPOApprover3,cReqPreIdenCand,cReqPreferredName,cReqPropAccumPOSpend,cReqRateCardC赋,cReqRateEndRange,cReqRateStartRange,cReqRateWSuper,cReqRecSearchFirm,cReqRemEndRange,cReqRemStartRange,cReqReplacementFor,cReqRequirements,cReqResTeamComments,cReqRetainer1,cReqRetainer2,cReqRetainer3,cReqRoleInfo,cReqRosterPatDetails,cReqSecondSourcing,cReqSrcPlan,cReqStartDate,cReqStartofRoster,cReqTesting,cReqTotalPOValuetodate,cReqTravel,cReqUserID,candidateProgress,城市, closedDateTime,corporatePosting,costCenterId,国家,createdDateTime,货币,defaultLanguage,删除,部门,分部,erpAmount,extPostEndDate,extPostStartDate,formDataId,formDueDate,instCongofStartReq,instrConfirmStarted,instrContractExtnReq,instrContractHistory,instrContractReq,instrEmpReq,instrExecAssignmentInfo,instrFurtherInstructions,instrInterview1,instrJobBrief, instrNewHireName,instrPosDetails,instrPostingDetails,instrProposedContractCost,instrProposedExtn,instrRateCardRate,instrReqCost,instrReqDetails,instrResTimeframe,instrRoleInfo,instrSrcPlan,instrToManager,internalStatusD,intrarafing, t,jobCode,jobGrade,jobGradeCode,jobReqGUId,jobReqId,jobRole,jobStartDate,lastModifiedBy,lastModifiedDateTime,lastModifiedProxyUserId,位置,numberOpenings,OpeningsFilled,总体比例名称,位置编号,邮政编码,额定申请人数,重定位成本,逆向比例,状态模板/ p>

1 个答案:

答案 0 :(得分:1)

您尝试使用$ skip吗?

https://xxxx.successfactors.com/odata/v2/JobRequisition?
$format=JSON&$filter=lastModifiedDateTime ge datetime'2015-08-27T00:00:00' 
and lastModifiedDateTime le datetime'2015-08-27T23:59:59'
&$top=100&$skip=100

这应该导致设置100-200,而不是0-100 ...

检查以下内容:https://blogs.sap.com/2013/03/20/using-odatas-top-skip-and-count/

我认为通过下一个链接或其他方式来实现此目标的可能性不大,这是不存在的。 我建议先使用$ count来获取总金额。然后使用top和skip命令检索页面大小。