Github API
Github API
9 API
Example
import requests

url = "URL"
response = requests.get(url).json()
print(response)
$url = "URL";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
const fetch = require('node-fetch');

const url = "URL";
fetch(url)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.log(error));
const url = "URL";
fetch(url)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.log(error));
import React, { useEffect } from 'react';

function App() {
  useEffect(() => {
    const url = "URL";
    fetch(url)
      .then(response => response.json())
      .then(data => console.log(data))
      .catch(error => console.log(error));
  }, []);

  return (
    <div>
      {/* Another component here */}
    </div>
  );
}

export default App;
<template>
  <div>
    <!-- Another component here -->
  </div>
</template>

<script>
import axios from 'axios';

export default {
  mounted() {
    const url = "URL";
    axios.get(url)
      .then(response => {
        console.log(response.data);
      })
      .catch(error => {
        console.log(error);
      });
  }
}
</script>
require 'net/http'
require 'json'

url = "URL"
uri = URI(url)
response = Net::HTTP.get(uri)
data = JSON.parse(response)
puts data
package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	url := "URL"
	response, err := http.Get(url)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}
	defer response.Body.Close()

	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	var data interface{}
	err = json.Unmarshal(body, &data)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	fmt.Println(data)
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        String url = "URL";
        try {
            URL apiUrl = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
            connection.setRequestMethod("GET");

            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                StringBuilder response = new StringBuilder();
                String line;
                while ((line = reader.readLine()) != null) {
                    response.append(line);
                }
                reader.close();

                String jsonResponse = response.toString();
                System.out.println(jsonResponse);
            } else {
                System.out.println("Error: " + responseCode);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
#include <iostream>
#include <curl/curl.h>
#include <jsoncpp/json/json.h>

size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* response) {
    size_t totalSize = size * nmemb;
    response->append(static_cast<char*>(contents), totalSize);
    return totalSize;
}

int main() {
    std::string url = "URL";

    CURL* curl = curl_easy_init();
    if (curl) {
        std::string response;

        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);

        CURLcode res = curl_easy_perform(curl);
        if (res == CURLE_OK) {
            Json::Value data;
            Json::CharReaderBuilder reader;
            std::istringstream jsonStream(response);
            std::string parseErrors;

            if (Json::parseFromStream(reader, jsonStream, &data, &parseErrors)) {
                std::cout << data << std::endl;
            } else {
                std::cout << "Failed to parse JSON: " << parseErrors << std::endl;
            }
        } else {
            std::cout << "Error: " << curl_easy_strerror(res) << std::endl;
        }

        curl_easy_cleanup(curl);
    }

    return 0;
}
Get User Information

Retrieve all account information, not including email and password.

https://forestapi.vercel.app/api/github/user/<username>

Output :

{
  "status": true,
  "username": "Account Username",
  "avatar_url": "Account Avatar URL",
  "name": "Account Name",
  "company": "Account Company Name",
  "blog": "Account Blog URL",
  "location": "Account Location",
  "bio": "Account Bio",
  "repositories": "Total Account Repository",
  "projects": "Total Account Projects",
  "packages": "Total Account Packages",
  "stars": "Total Account Stars",
  "followers": "Total Account Followers",
  "following": "Total Account Following",
  "social": [
    "Account Social Links"
  ]
}
Get Repository List

Take a list of repositories on account.

https://forestapi.vercel.app/api/github/user/<username>/repos

Output :

[
  {
    "status": true,
    "title": "Repository Title",
    "url": "Repository URL",
    "description": "Repository Description",
    "language": "Repository Language",
    "tags": [
      "Repository Tags"
    ],
    "stars": "Total Repository Stars",
    "forks": "Total Repository Forks",
    "date_info": "Time created Repository"
  }
]
Get Followers List

Take a list of followers on account.

https://forestapi.vercel.app/api/github/user/<username>/followers

Output :

[
  {
    "status": true,
    "avatar_url": "Followers Avatar URL",
    "username": "Followers Username",
    "name": "Followers Name",
    "bio": "Followers Bio",
    "company": "Followers Company Name",
    "location": "Followers Location"
  }
]
Get Following List

Take a list of following on account.

https://forestapi.vercel.app/api/github/user/<username>/following

Output :

[
  {
    "status": true,
    "avatar_url": "Following Avatar URL",
    "username": "Following Username",
    "name": "Following Name",
    "bio": "Following Bio",
    "company": "Following Company Name",
    "location": "Following Location"
  }
]
Get Stars List

Take a list of stars on account.

https://forestapi.vercel.app/api/github/user/<username>/stars

Output :

[
  {
    "status": true,
    "username": "Username Repository Author",
    "repository": "Repository Title",
    "description": "Repository Description",
    "stars": "Repository Stars",
    "forks": "Repository Forks",
    "language": "Repository Language",
    "date_info": "Time created Repository"
  }
]
Get Repository Information

Retrieve all repository information on account.

https://forestapi.vercel.app/api/github/repository/<username>/<repository>

Output :

{
  "status": true,
  "thumbnail_url": "Repository Thumbnail URL",
  "title": "Repository Title",
  "description": "Repository Description",
  "url": "Repository URL External",
  "stars": "Total Repository Stars",
  "forks": "Total Repository Forks",
  "issues": "Total Repository Issues",
  "pull_requests": "Total Repository Pull Requests",
  "projects": "Total Repository Projects",
  "releases": "Total Repository Releases",
  "contributors": "Total Repository Contributors",
  "tags": [
    "Repository Tags"
  ],
  "language": [
    "Repository Language"
  ]
}
Get Repository Stars List

Take the repository star list on account.

https://forestapi.vercel.app/api/github/repository/<username>/<repository>/stars

Output :

[
  {
    "status": true,
    "avatar_url": "Repository Stars Avatar URL",
    "username": "Repository Stars username",
    "name": "Repository Stars Name",
    "text": "Repository Stars Company Name or Bio"
  }
]
Get Repository Forks List

Take the repository fork list on account.

https://forestapi.vercel.app/api/github/repository/<username>/<repository>/forks

Output :

[
  {
    "status": true,
    "avatar_url": "Repository Forks Avatar URL",
    "username": "Repository Forks Username",
    "repository": "Repository Forks Name",
    "stars": "Total Stars Repository Forks",
    "forks": "Total Forks Repository",
    "issues": "Total Issues Repository Forks",
    "pulls": "Total Pull Requests Repository Forks",
    "created_at": "Time created Repository Forks",
    "updated_at": "Time updated Repository Forks"
  }
]
Git CDN

Linking css or javascript files via CDN to your website, linked to files on the repository of the github account.

https://forestapi.vercel.app/cdn/github/<username>/<repository>/<branch>/<file_path>

Output :

The result of the code file.