1

我正在使用 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,c​​ReqPreIdenCand,cReqPreferredName,cReqPropAccumPOSpend,cReqRateCardCode,cReqRateEndRange,cReqRateStartRange,cReqRateWSuper,cReqRecSearchFirm,cReqRemEndRange,cReqRemStartRange,cReqReplacementFor,cReqRequirements,cReqResTeamComments,cReqRetainer1,cReqRetainer2,cReqRetainer3,c​​ReqRoleInfo,cReqRosterPatDetails,cReqSecondSourcing, cReqSrcPlan,cReqStartDate,cReqStartofRoster,cReqTesting,cReqTotalPOValuetodate,cReqTravel,cReqUserID,candidateProgress,city,closedDateTime,corporatePosting,costCenterId,country,createdDateTime,currency,defaultLanguage,deleted,department,division,erpAmount,extPostEndDate,extPostStartDate,formDataId,inqReformDueDate, instrConfirmStarted,instrContractExtnReq,instrContractHistory,instrContractReq,instrEmpReq,instrExecAssignmentInfo,instrFurtherInstructions,instrInterview1,instrJobBrief,instrNewHireName,instrPosDetails,instrPostingDetails,instrProposedContractCosts,instrProposedExtn,instrRateCardRate,instrReqCost,instrReqDetails,instrResTimeframe,instrRoleInfo,instrSrcPlan,instrToManager,internalStatus,intranetPosting,isDraft,jobCode,jobGrade,jobGradeCode,jobReqGUId,jobReqId,jobRole, jobStartDate,lastModifiedBy,lastModifiedDateTime,lastModifiedProxyUserId,location,numberOpenings,openingsFilled,overallScaleName,positionNumber,postalcode,ratedApplicantCount,relocationCost,reverseScale,stateProvince,statusSetId,templateId,templateType,timeToFillinstrResTimeframe,instrRoleInfo,instrSrcPlan,instrToManager,internalStatus,IntranetPosting,isDraft,jobCode,jobGrade,jobGradeCode,jobReqGUId,jobReqId,jobRole,jobStartDate,lastModifiedBy,lastModifiedDateTime,lastModifiedProxyUserId,位置,编号开口,开口填充,整体ScaleName,位置编号,邮政编码,额定申请人数,重新定位reverseScale,stateProvince,statusSetId,templateId,templateType,timeToFillinstrResTimeframe,instrRoleInfo,instrSrcPlan,instrToManager,internalStatus,IntranetPosting,isDraft,jobCode,jobGrade,jobGradeCode,jobReqGUId,jobReqId,jobRole,jobStartDate,lastModifiedBy,lastModifiedDateTime,lastModifiedProxyUserId,位置,编号开口,开口填充,整体ScaleName,位置编号,邮政编码,额定申请人数,重新定位reverseScale,stateProvince,statusSetId,templateId,templateType,timeToFill

4

1 回答 1

2

您是否尝试过使用 $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 命令检索您的页面大小。

于 2018-09-12T09:06:27.750 回答