通途erp对接订单,添加手工订单Api遇到的问题,已经问题处理解决

技术问题 · Fecmall · 于 2年前 发布 · 1296 次阅读

通途erp手动创建订单Api:https://open.tongtool.com/apiDoc.html#/?docId=908e49d8bf62487aa870335ef6951567

urlKey:/openapi/tongtool/orderImport

1.php执行出现莫名问题报错:`400,

(放大浏览器可以看图片内容)

本人传递的参数:

2.curl执行

curl -X POST 'https://open.tongtool.com/api-service/openapi/tongtool/orderImport?app_token=4abde655c3d4bf2347931c235e6b11a9&timestamp=1627617880&sign=8c20c78f3784936bff6a819b7480d62b' -H 'Content-Type:application/json' -H 'api_version:3.0' -d '{"order":{"buyerInfo":{"buyerAccount":"qweqw@11.com","buyerAddress1":"dsafdsf","buyerAddress2":"asda","buyerAddress3":"","buyerCity":"asd","buyerState":"FM","buyerCountryCode":"US","buyerEmail":"qweqw@11.com","buyerMobilePhone":"234234","buyerName":"rqwer qweqw","buyerPhone":"234234","buyerPostalCode":"1234123"},"currency":"USD","insuranceIncome":"","insuranceIncomeCurrency":"","needReturnOrderId":"0","notes":"","ordercurrency":"USD","paymentInfos":[{"orderAmount":"154.00","orderAmountCurrency":"USD","paymentAccount":"","paymentDate":"","paymentMethod":"check_money","paymentNotes":"","paymentTransactionNum":null,"recipientAccount":"","url":""}],"platformCode":"Fecmall","remarks":"","saleRecordNum":"1100006760","sellerAccountCode":"","shippingMethodId":"free_shipping","taxIncome":"","taxIncomeCurrency":"","totalPrice":"154.00","totalPriceCurrency":"USD","transactions":[{"sku":"po0001","goodsDetailRemark":"","productsTotalPrice":"121.00","productsTotalPriceCurrency":"USD","quantity":"1","shipType":"free_shipping","shippingFeeIncome":"0.00","shippingFeeIncomeCurrency":"USD"},{"sku":"men0001","goodsDetailRemark":"","productsTotalPrice":"33.00","productsTotalPriceCurrency":"USD","quantity":"1","shipType":"free_shipping","shippingFeeIncome":"0.00","shippingFeeIncomeCurrency":"USD"}],"warehouseId":""},"merchantId":"0a27bf0b2a2b

报错:

<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><hr class="line" /><h3>Apache Tomcat/8.5.30</h3></body></html>[root@iZ942k2d5ezZ fecshop]#

小结

报错一致都是400, 本人一度怀疑是urlKey有问题,因为,我将https://open.tongtool.com/api-service/openapi/tongtool/orderImport 换成 https://open.tongtool.com/api-service/openapi/tongtool/orderImport22222222222222222,这样一个不存在的url key还是返回400

咨询通途客服,客服积极回复,给联系了技术,奈何这个技术是个三把刀擦皮球选手,啥毛帮不上,

问题原因,以及解决

继续看文档研究,忙活了半天,最终解决,原因是我传递了remarks

明明文档里面写了的参数,明明让你传递值的参数,你不能传递,如果传递了就报错http 400,其他的啥提示都没有。请问这样的问题排查起来,难于天。

这样的奇葩api,内网中遇到也就罢了,关键是对外开放的api,另外通途erp这个技术,上辈子应该是擦皮鞋的,工单问题不解决,打电话问题不解决就挂电话,找到问题后回复问题所在,消极怠慢

本人的问题已经解决,就是浪费了半天功夫,通途erp的这个问题还是会存在,本人将其整理出来,希望通途解决,不要让类似这样的垃圾技术消极处理问题,坏了一锅粥,让后面对接api的人犯难。

Api文档问题总结

通途erp手工创建订单文档:https://open.tongtool.com/apiDoc.html#/?docId=908e49d8bf62487aa870335ef6951567

api文档存在的问题:

1.api中很多参数,在文档中标注的都是选填,但是不传递参数就报错

解决:请将必填的参数,将选填改为必填

2.remarks参数在文档中标注的是选填,但是,你如果填写了就报错400,一点提示信息都没有,坑你没商量, 这是选填吗?这明明就是不让你填写,不让填写的参数,填写就报错的参数,为什么出现在文档中?

解决:文档需要删除掉这个参数!

3.对于quantity参数,文档字段说明写的是int类型,但是下面的demo例子是string,自己的demo都写错,这个demo是认真的吗?

解决:请修改demo数据内容

4.对你们demo例子的输出结果

{
  "code": "999999",
  "datas": null,
  "message": "账号已过期",
  "others": "redirectUrl:http://www.tongtool.com"
}

账号已过期,你这是认真的吗?用一个过期的账户测试demo?你的demo传递的数据都有错误,还有什么参考价值?

解决:请你们的技术认真的处理这个问题,写真实的demo返回的数据

该问题的工单号:WO0000771

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics