我正在尝试使用sears api,由于我对西尔斯提供的文档缺乏了解,我的流程失败了
这是西尔斯网址
https://www.searscommerceservices.com/question/seller-facing-api-changes-0216/
根据他们给出的关于如何生成签名和验证的内容我正在尝试这样的事情,但我收到了错误:
请求已超时
这是我的尝试CF
<cfscript>
function ISODateFormat(datetime) {
return '#DateFormat(datetime, "yyyy-mm-dd")#T#TimeFormat(datetime, "HH:mm:ss")#Z';
}
</cfscript>
<cfset variables.sellerid = '1234'>
<cfset variables.emailaddress = 'abc@domain.com'>
<cfset variables.secretkey = 'xxxx='>
<cffunction name="auth" access="public" returntype="any">
<cfset var myResult="">
<cfset sDate = ISODateFormat(now())>
<cfset StrtoSig = "#variables.sellerid#:#variables.emailaddress#:#sDate#">
<cfset secretKey = variables.secretkey>
<cfset x = hmac("#StrtoSig#","#secretKey#","HMACSHA256","utf-8")>
<cfreturn x>
</cffunction>
<cffunction access="public" name="getitems" returntype="any">
<cfset surl = 'https://seller.marketplace.sears.com/SellerPortal/api/attributes/v4?itemClassId=1234&sellerId=1234'>
<cfset getauth = auth()>
<cfset sheader = "authorization:HMAC-SHA256 emailaddress=#variables.emailaddress#,timestamp=#sDate#,signature=#getauth#">
<cfhttp url="#surl#" result="results">
<cfhttpparam name="authorization" type="HEADER" value="#sheader#">
</cfhttp>
<cfdump var="#results#">
</cffunction>