nodejs 使用 axios 参数配置问题
l雪狼l 发布于2018-10 浏览:3043 回复:4
0
收藏

错误提示:

error_code: 216101,
error_msg: 'param image not exist'

nodejs 

axios({
method: 'post',
url: 'https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic',

params: {

    access_token: '24.05c29b2db7bb11bb4b06588b6dacef05.2592000.1541481439.282335-14358355'
},
data: {
    image:“base64 编码,已经用 postman 测试过了,可以正常返回数据”
},
header: {
    'Content-Type': 'application/x-www-form-urlencoded',
},

})

收藏
点赞
0
个赞
共4条回复 最后由vx27422回复于2022-04
#5misd_ciic回复于2020-05

// syntax alternative to send data into the body
// method post
// only the value is sent, not the key
data: 'image=' + 'your-base64-data',

根据官方文档,还可以使用字符串形式传递参数,测试可行

0
#4不懂即是懂回复于2018-12

显示不存在,路径不对

0
#3jxgzzyf韦德回复于2018-11

用 params 代替 data

0
#2用户已被禁言回复于2018-10

这个错误是证明你的参数放的位置不对。axios我也不会。node也不会。但是node通过API调用接口是完全没有问题的。你非使用axios调用的话。最好是多深入了解一下axios的架构。

 

http://ai.baidu.com/forum/topic/show/497843  nodejs 通过API调用接口示例代码可以参考一下哦

1
TOP
切换版块