anuraghazra / github-readme-stats

:zap: Dynamically generated stats for your github readmes
https://github-readme-stats.vercel.app
MIT License
66.51k stars 21.56k forks source link

Feature Request: JSON API #624

Open nathanchu opened 3 years ago

nathanchu commented 3 years ago

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

anuraghazra commented 3 years ago

@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
dopecodez commented 3 years ago

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

nathanchu commented 3 years ago

@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 commented 3 years ago

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?

Enissay commented 1 month ago

Any update on this please ?