How to create a GET response with json data using github pages ?

Hi, in this tutorial i will be showing you how to create a sample json response which can be fetched using GET request in your web or mobile applications. We will be using github for this. Follow the following steps

1) First thing you will need is to have a github account. If you don't have one go here and create one. If you already have one proceed to the next step
Github Signup page

2) Log in to your account and then click the "+" icon in top right corner , then click "New Repository" to create a new repository
New Repository creation page

3) Now while naming the repository, you will have to follow a particular convention so that your page automatically gets hosted. The convension is that you will have to name it like this >> , i.e, replace "your_github_username" with your actual github username .Please note that it won't work if you don't follow this convention. Click create repository.

4) Now, if you open your repository you may see a window similar to the one below
Repository Files Browser
In the above window, you can add the json file by clicking either "upload files" to upload as a file or click "create new file" to create a file directly in the repository.

5) If you are creating a json file, click "create new file" which will bring up the following window where you will need to enter file name and contents as shown below
Create json file

6) Now click commit button at the bottom of the window.
6)Thats it, now you can parse the json as a GET response from either you web/mobile applications using the url, in my case it is

No comments:

Post a Comment