【问题标题】:Requests in different format HTTP POST to CURL不同格式的请求 HTTP POST 到 CURL
【发布时间】:2017-09-06 16:31:58
【问题描述】:

我是 API 集成的新手,所以我需要一些帮助来连接和测试端点。谁能帮我在 CURL 中转换这个 HTTP 帖子?或任何不同的方式用它在 python 或 js 中编写程序。

POST URL:
https://api.hubapi.com/oauth/v1/token
Headers:
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Data:
grant_type=authorization_code&client_id=xxxxxxxx-xxxx-xxxx-xxxx-
xxxxxxxxxxxx&client_secret=yyyyyyyy-yyyy-yyyy-yyyy-
yyyyyyyyyyyy&redirect_uri=http://www.hubspot.com/&code=zzzzzzzz-zzzz-
zzzz-zzzz-zzzzzzzzzzzz

【问题讨论】:

    标签: javascript python curl post http-post


    【解决方案1】:

    卷曲请求将是:

    curl -H "Content-Type: application/x-www-form-urlencoded;charset=utf-8" -X POST -d 'grant_type=authorization_code&client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&client_secret=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy&redirect_uri=http://www.hubspot.com/&code=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz' https://api.hubapi.com/oauth/v1/token
    

    【讨论】:

    • 如何将其转换为 URL 并在链接选项卡中的 chrome 浏览器中使用。
    • @DinuDuke 您无法将 POST 请求转换为 URL(即 GET 请求),但是您可以使用开发者控制台或 Postman 在 Chrome 中创建 POST 请求
    猜你喜欢
    • 2015-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    相关资源
    最近更新 更多