How to use curl to access the github graphql API

前端 未结 3 1200
旧时难觅i
旧时难觅i 2020-12-29 05:51

After referring this guide I needed to access the github graphql by using curl for a testing purpose. I tried this simple command

         


        
3条回答
  •  情话喂你
    2020-12-29 05:58

    You just need to escape the double quotes that are inside the JSON as the query

    $ 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
    
    

提交回复
热议问题