soccerway
soccerway

Reputation: 11991

How to call an API in GitHub

I have Uploaded a simple REST API java project in github. How can I call the API via url in GitHub to see if the API is working? I have read some documents about curl, but I am not sure how to use it.

 https://api.github.com/repos/github_user_name/project_name/getUser?id=100

Upvotes: 2

Views: 1388

Answers (2)

VonC
VonC

Reputation: 1327014

You should not be able to cal your own API using a GitHub URL.

You cannot execute any custom process on the server (GitHub) side, except GitHub actions (like those ones).

You can use for instance Netlify to test your API from your GitHub project.


Can we use Gitlab for achieving the result ?

No: GitHub or GitLab are for hosting repositories, not for serving any custom services from those repositories (beside GitHub Pages or GitLab Pages, for publishing static websites directly from a repository)

Again, for exposing a REST API, you need a third party server.

Upvotes: 2

Sayak Mukhopadhyay
Sayak Mukhopadhyay

Reputation: 1464

GitHub only serves static web pages and does not provide any way to host a server. Your Spring Boot app is essentially a server so it is not possible to check the API through GitHub as you are intending. There are some free solutions out there like Heroku which you can use for testing purposes.

Related: How to publish a website made by Node.js to Github Pages?

Upvotes: 1

Related Questions