github-readme-stats icon indicating copy to clipboard operation
github-readme-stats copied to clipboard

Feature Request: JSON API

Open nathanchu opened this issue 5 years ago • 5 comments

Is your feature request related to a problem? Please describe. It would be cool if there was a json api for each card.

Describe the solution you'd like For example /api/json?username=nthnchu would return:

{
  "name": "Nathan Chu",
  "stars": 2,
  "commits_this_year": 561,
  "pull_requests": 18,
  "issues": 52,
  "contributed_to": 15,
  "grade": "A+"
}

Yes, I know I could just fetch from the API, but this would simplify things if I wanted to include it on my site, but in a different layout.

Describe alternatives you've considered Using the GH api

Additional context N/A

nathanchu avatar Nov 06 '20 17:11 nathanchu

@nthnchu Yeah i think it would be nicer to have a JSON API.

What i was thinking is that instead of creating separate routes we can also use query param to set the return type. we can be more flexible that way in future without needing to add more api routes and it would be much simpler too

example ->

https://github-readme-stats.vercel.app/api?username=anuraghazra&response_type=json


https://github-readme-stats.vercel.app/api?username=anuraghazra&response_type=xml

// defaults to rendered image
https://github-readme-stats.vercel.app/api?username=anuraghazra

anuraghazra avatar Nov 14 '20 12:11 anuraghazra

I'd take this up, would be a useful feature to have within this tool. Great tool, btw!

dopecodez avatar Nov 25 '20 05:11 dopecodez

@dopecodez I've been working on this some, but suggestions are welcome! Do you have any good json to xml library suggestions, by chance? #665

nathanchu avatar Nov 26 '20 02:11 nathanchu

I've been using xml2js, which seems to be more popular. Do you know if this is faster or has any other advantages over xml2js?

nathanchu avatar Nov 30 '20 22:11 nathanchu