Contains REST API that will provide git api support. For example it will search repositories by language name.
- Clone this repository and build using command
mvn clean install - Run this project as Application or run App.java class
- server will start on port
9000. will configurable in application.properties file.
- I have checked in jar also. So we can run directly using jar.
- download this jar and run below command
java -jar demo-0.0.1-SNAPSHOT.jar
- this will start server at port
9000
- We have search api implemented here. Below informatin will give idea about api
API endpoint : /search/repositories/{language}. Where we can search repos by language name.
Method type : GET
sort -> Sorts the results of your query by number of stars, forks, or help-wanted-issues or how recently the items were updated.
order -> Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.
per_page -> Results per page (max 100)
page -> Page number of the results to fetch.
For example :
curl -X GET \
http://localhost:9000/search/repositories/assembly \
-H 'perPage: 3'
{
"metaData": {
"status": "200 OK"
},
"items": [
{
"owner": {
"login": "chrislgarry"
},
"id": "18408635",
"name": "Apollo-11",
"git_url": "git://github.com/chrislgarry/Apollo-11.git"
},
{
"owner": {
"login": "microsoft"
},
"id": "138634298",
"name": "MS-DOS",
"git_url": "git://github.com/microsoft/MS-DOS.git"
},
{
"owner": {
"login": "compiler-explorer"
},
"id": "4414698",
"name": "compiler-explorer",
"git_url": "git://github.com/compiler-explorer/compiler-explorer.git"
}
]
}
{
"metaData": {
"error": "Request Failed due to Internal Server Error.",
"status": "500 INTERNAL_SERVER_ERROR"
},
"items": null
}