Senior LevelGit & GitHub
Compare GitHub REST API v3 vs GitHub GraphQL API v4 for enterprise integration.
❓ Interview Prompt: Compare GitHub REST API v3 (multiple endpoint roundtrips, over-fetching) versus GitHub GraphQL API v4 (single query nested graphs, precise payload fetching).
GitHub GraphQL API v4 allows fetching complex nested repository, PR, and review graphs in a single HTTP request, reducing network calls and payload size by up to 90% vs REST v3.
Code Implementation Example
bash
curl -X POST -H "Authorization: bearer $TOKEN" -d '{"query": "query { repository(owner:"org", name:"repo") { pullRequest(number:42) { title } } }"}' https://api.github.com/graphql💡Fetching nested pull request review data using GitHub GraphQL API v4.
🎯 Interview Key Takeaway
Use GitHub GraphQL API v4 to query complex nested repository, PR, and review data in a single HTTP request.
#GraphQL#REST API#GitHub API#Senior
Back to all Git & GitHub Questions→