【问题标题】:Converting following curl command to axios将以下 curl 命令转换为 axios
【发布时间】:2018-08-03 09:01:00
【问题描述】:

以下 curl 命令的 axios 等效项是什么?

curl -G https://octopart.com/api/v3/parts/match    
-d queries='[{"mpn":"SN74S74N"}]'    
-d apikey=KEY      
-d limit=0 
-d include[]=specs 
-d show[]=specs

提前致谢

【问题讨论】:

  • 将 URL 字符串和查询参数作为对象提供给 axios,如文档中所述。

标签: node.js curl axios


【解决方案1】:

此代码将帮助您。

axios.post('https://octopart.com/api/v3/parts/match ',
 {queries: [{mpn:"SN74S74N"}], apikey: "KEY", limit: 0, include:["specs"], show: ["specs"]}
)
.then( response => {
     console.log("Response is: ", response);
})
.catch( error => {
     console.log("Error is :", error);
});

【讨论】:

    猜你喜欢
    • 2019-04-22
    • 2021-04-28
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    相关资源
    最近更新 更多