如何知道调用电商API是否成功返回数据?查看错误码解释

    在API调用过程中,系统可能会返回一些错误码。错误码能够帮助开发者快速准确地了解出现的异常情况。错误码的含义通常涉及到请求参数不合法、认证失败、服务器内部错误等各种问题,它们提供了有关API调用失败的信息和上下文,在错误排查和修复时都非常重要。

因此,开发者需要对API接口返回的错误码进行解释和处理。通过解释错误码,可以更好地理解API的使用规则和限制,同时可以提供更好的用户体验,并根据具体的错误信息采取不同的容错措施或者联系技术支持团队来解决问题。

多电商平台API调用

 错误码解释

状态代码(error_code) 状态信息 详细描述 是否收费
0000 success 接口调用成功并返回相关数据
2000 Search success but no result 接口访问成功,但是搜索没有结果
4000 Server internal error 服务器内部错误
4001 Network error 网络错误
4002 Target server error 目标服务器错误
4003 Param error 用户输入参数错误 忽略
4004 Account not found 用户帐号不存在 忽略
4005 Invalid authentication credentials 授权失败 忽略
4006 API stopped 您的当前API已停用 忽略
4007 Account stopped 您的账户已停用 忽略
4008 API rate limit exceeded 并发已达上限 忽略
4009 API maintenance API维护中 忽略
4010 API not found with these values API不存在 忽略
4012 Please add api first 请先添加api 忽略
4013 Number of calls exceeded 调用次数超限 忽略
4014 Missing url param 参数缺失 忽略
4015 Wrong pageToken 参数pageToken有误 忽略
4016 Insufficient balance 余额不足 忽略
4017 timeout error 请求超时
5000 unknown error 未知错误

异常示例

{
    "error": "item-not-found",
    "reason": "商品没找到",
    "error_code": "2000",
    "success": 0,
    "cache": 0,
    "api_info": "today:0 max:10000",
    "execution_time": 0.081,
    "server_time": "Beijing/2020-06-10 23:44:00",
    "call_args": [],
    "api_type": "taobao",
    "request_id": "15ee0ffc041242"}

 已完成部分API列表:

  • item_get 获得淘宝商品详情
  • item_get_pro 获得淘宝商品详情高级版
  • item_review 获得淘宝商品评论
  • item_fee 获得淘宝商品快递费用
  • item_password 获得淘口令真实url
  • item_list_updown 批量获得淘宝商品上下架时间
  • seller_info 获得淘宝店铺详情
  • item_search 按关键字搜索淘宝商品
  • item_search_tmall 按关键字搜索天猫商品
  • item_search_pro 高级关键字搜索淘宝商品
  • item_search_img 按图搜索淘宝商品(拍立淘)
  • item_search_shop 获得店铺的所有商品
  • item_search_seller 搜索店铺列表
  • item_search_guang 爱逛街
  • item_search_suggest 获得搜索词推荐
  • item_search_jupage 天天特价
  • item_search_coupon 优惠券查询
  • cat_get 获得淘宝分类详情
  • item_cat_get 获得淘宝商品类目
  • item_search_samestyle 搜索同款的商品
  • item_search_similar 搜索相似的商品
  • item_sku 获取sku详细信息
  • item_recommend 获取推荐商品列表
  • brand_cat 获取品牌分类列表
  • brand_cat_top 获取分类推荐品牌列表
  • brand_cat_list 得到指定分类的品牌列表
  • brand_keyword_list 得到指定关键词的品牌列表
  • brand_info 得到品牌相关信息
  • brand_product_list 得到指定品牌的产品
  • custom 自定义API操作

猜你喜欢

转载自blog.csdn.net/Jernnifer_mao/article/details/130801079