gpt4 book ai didi

curl - 如何使用curl访问github graphql API

转载 作者:行者123 更新时间:2023-12-03 23:25:48 26 4
gpt4 key购买 nike

引用此后 guide我需要访问 github graphql通过使用 curl用于测试目的。我试过这个简单的命令

curl -i -H "Authorization: bearer myGithubAccessToken" -X POST -d '{"query": "query {repository(owner: "wso2", name: "product-is") {description}}"}' https://api.github.com/graphql

但它给了我

problems parsing JSON



我做错了什么。我花了将近 2 个小时试图弄清楚它并尝试了不同的示例,但没有一个起作用。你能帮我解决这个问题吗

最佳答案

您只需要将 JSON 中的双引号作为查询进行转义

$ curl -i -H 'Content-Type: application/json' -H "Authorization: bearer myGithubAccessToken" -X POST -d '{"query": "query {repository(owner: \"wso2\", name: \"product-is\") {description}}"}' https://api.github.com/graphql

关于curl - 如何使用curl访问github graphql API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42021113/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com