首页 > 其他分享 >FedEx的api对接

FedEx的api对接

时间:2022-10-20 20:50:27浏览次数:42  
标签:request 对接 fedex token api https FedEx com

1:api地址

 

 

 

2:文档地址

 https://www.fedex.com/secure-login/zh-cn/#/login-credentials

 https://developer.fedex.com/api/zh-cn/home.html

 

3:注册账号

 

4:新建组织

 

 

5:新建项目

 

 

 

6:项目添加api

 

 

 

 7:记录项目key和密钥

 

 

 

 

8:accessToken生成

 

 地址:https://apis-sandbox.fedex.com/oauth/token

grant_type=csp_credentials&client_id=Client_ID&client_secret=Client_secret&child_Key=Child_key&child_secret=Child_Secret
  请求:
var client = new RestClient("https://apis-sandbox.fedex.com/oauth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
// 'input' refers to JSON Payload
request.AddParameter("", input, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

响应:

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX……",
"token_type": "bearer",
"expires_in": 3600,
"scope": "CXS"
}

 

 

 

9:获取费率api

  

 

 

 

入参:

注意:accountNumber是你注册后邮箱收到的accountNumber

 

 

 

 

 

{
"accountNumber": {
"value": "XXXXX7364"
},
"requestedShipment": {
"shipper": {
"address": {
"postalCode": 65247,
"countryCode": "US"
}
},
"recipient": {
"address": {
"postalCode": 75063,
"countryCode": "US"
}
},
"pickupType": "DROPOFF_AT_FEDEX_LOCATION",
"rateRequestType": [
"ACCOUNT",
"LIST"
],
"requestedPackageLineItems": [
{
"weight": {
"units": "LB",
"value": 10
}
}
]
}
}

 

标签:request,对接,fedex,token,api,https,FedEx,com
From: https://www.cnblogs.com/wugh8726254/p/16811198.html

相关文章