Sample Rest Api Url For Testing With Authentication


Are you looking for a sample dummy REST JSON API to test in Postman with authentication, along with dummy test data for developing test cases for your project, mobile app, or web application? You've come to the right place! We offer a list of free APIs for developers and testers. Our list includes dummy REST APIs with authentication for practice and demo purposes. You can use them without an API key, they're free for developers.

Since this post provides a sample API with authentication, we are using basic authentication. To obtain the username and password, you first need to hit the user registration API. This will provide you with the credentials to include in the authentication header of the HTTP client.

Api Base Url- http://samplerestapi.com

Api List-

Registration API

Below is the Request/Response of the sample user registration API. we have also attached the screenshot of the Request/Response of the postman.

You need to pass the three parameters in the request body i.e name, email, and password. After Successful registration, In response you will able to get user detail including auth token. you can use the token for calling secure API.we are using the basic authentication method for validating the API Request.

If you are looking sample rest api url for testing without authentication then please follow below link

Registration API-

http://samplerestapi.com/api/account/registration

Post/api/account/registration
API Request
{
    "name": "ankishRR",
    "email": "[email protected]",
    "password": "123456"
}

API Response

{
    "code": 0,
    "message": "success",
    "data": {
    "Id": 17,
    "Name": "ankishRR",
    "Email": "[email protected]"
  }
}

If the user already exists, you will receive an error message in API Response

{
    "code": 1,
    "message": "The email address you have entered is already registered",
    "data": null
}

Login API-

If you already have a username and password previously created, you can verify them using the login API.

You need to pass the two parameters in the request body i.e email and password. After Successful User Login, In Api response you will able to get user detail

http://samplerestapi.com/api/account/login

Post/api/account/login
API Request
{
    "email":"[email protected]",
"password": "123456"
}

API Response

{
    "code": 0,
    "message": "success",
    "data": {
    "Id": 17,
    "Name": "ankishRR",
    "Email": "[email protected]"
  }
}

If email or password is wrong then in API Response, you will get error message

{
    "code": 1,
    "message": "invalid username or password",
    "data": null
}

Calling Rest Api with Basic Authentication

Users

You can use these sample REST API URLs for testing with authentication in programming languages like Java, JavaScript, Python, React.js, Angular.js, etc.

As we mention the basic authentication method for validating the API Request. So you need to set the Authorization header for calling the secure API otherwise you will get the 401 authentication error.

Header-

Authorization: Basic dGhhcGxpeWFsYW5raWlzaDkyNThAZ21haWwuY29tOjEyMzQ1Ng==


Get SoloTraveller

This API returns all solotraveller in the organization 

http://samplerestapi.com/api/solotraveller?page=1

GET/api/solotraveller?page=1

API Response

{
            "page": 1,
            "per_page": 10,
            "totalrecord": 14741,
            "total_pages": 1475,
            "data": [
        {
            "id": 281850,
            "traveller_fullname": "jitendra",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "USA",
            "createdat": "0001-01-01T00:00:00"
        },
        {
            "id": 277687,
            "traveller_fullname": "id-hf809xq",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "Shanghai",
            "createdat": "2023-10-19T01:39:51.5821027"
        },
        {
            "id": 280725,
            "traveller_fullname": "Dani",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "USA",
            "createdat": "0001-01-01T00:00:00"
        },
        {
            "id": 273335,
            "traveller_fullname": "Developer",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "USA",
            "createdat": "0001-01-01T00:00:00"
        },
        {
            "id": 15361,
            "traveller_fullname": "Alvin Ondricka",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "USA",
            "createdat": "0001-01-01T00:00:00"
        },
        {
            "id": 282330,
            "traveller_fullname": "Sagar",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "Pune",
            "createdat": "2023-11-07T07:52:55.8795549"
        },
        {
            "id": 275649,
            "traveller_fullname": "id-doit1y8",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "Shanghai",
            "createdat": "2023-10-12T07:09:43.9637336"
        },
        {
            "id": 16419,
            "traveller_fullname": "gvagbga",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "gvagbga",
            "createdat": "2022-01-18T10:53:00.1743466"
        },
        {
            "id": 16179,
            "traveller_fullname": "pssssspd",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "eatecf",
            "createdat": "2022-01-18T09:25:17.0299138"
        },
        {
            "id": 275555,
            "traveller_fullname": "id-pdpk0cf",
            "traveller_email": "[email protected]",
            "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
            "geo_location": "Shanghai",
            "createdat": "2023-10-11T21:09:16.7133482"
        }
    ]
}

Get solotraveller by Id

GET: /api/solotraveller/275555 It will return solotraveller with id=275555 in the database

http://samplerestapi.com/api/solotraveller/275555

GET/api/solotraveller/275555
API Response
{
    "id": 275555,
    "traveller_fullname": "id-pdpk0cf",
    "traveller_email": "[email protected]",
    "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
    "geo_location": "Shanghai",
    "createdat": "2023-10-11T21:09:16.7133482"
}

 

Create solotraveller object API-

You need to pass three parameters in the request body: name, email, and location. In response, you will be able to retrieve details of the solo traveler.

http://samplerestapi.com/api/solotraveller

POSTapi/solotraveller
API Request
{
    "traveller_fullname": "Jack Traveler",
    "traveller_email": "[email protected]",
    "geo_location": "Denmark"
}

API Response

{
    "id": 319719,
    "traveller_fullname": "Jack Traveler",
    "traveller_email": "[email protected]",
    "profilepicture": "http://samplerestapi.com/media/Images/userimageicon.png",
    "geo_location": "Denmark",
    "createdat": "2024-03-08T10:21:42.274684Z"
}

 

Update Solotraveller Object API-

This endpoint is used to update the solotraveller object. You just need to pass the solotraveller object in the request body. In response, you will be able to get the details of the updated solotraveller.

http://samplerestapi.com/api/solotraveller

PUT/api/solotraveller/319719
API Request
{
    "Id":319719,
    "traveller_fullname": "Jack Traveler new name",
    "traveller_email": "[email protected]",
    "geo_location": "Denmark"
}

API Response

{
    "id": 319719,
    "traveller_fullname": "Jack Traveler new name",
    "traveller_email": "[email protected]",
    "profilepicture": "http://samplerestapi.com/media/images/userimageicon.png",
    "geo_location": "Denmark",
    "createdat": "2024-03-08T10:21:42.274684"
}

 

DELETE solotraveller by Id

This API end point delete the solotraveller object in the database

http://samplerestapi.com/api/solotraveller/319719

DELETE/api/solotraveller/319719
API Response
{
    "Message": "User deleted successfully!"
}

 

If you have any query please comment.

We all have heard about the API, but there will be many of us who will not know about the API. If you are interested in learning about computer programming language or software development, then you must know about API.

API is a software code that helps to communicate different software programs. As we get to know a lot more about it by its name, the Application Programming Interface means that the system programming the application, overall the API is a system through which our Application communicate.

So today I thought that I will give you detailed information about the API so that you do not face any problem regarding the API. So without delay let’s know what is API and what are its benefits.

if we run an application on our phone or computer, then when the application connects to the Internet Or, then it sends data to a server. The server receives that data acts on it, do whatever work you want, and then sends that data back to your phone or your computer.

All this work is done through an API. That task of any application without API is difficult.

Suppose you have gone to a restaurant to eat food, then you will have a menu from which you can choose what to eat. Now if you order a pizza, a waiter will come, he will go to the kitchen and the person who is working in the kitchen will make pizza, then that waiter will come to you and give you pizza.

In this example, the waiter is working is between us and the kitchen people. In this case, The pizza is an application that we start and then the waiter is the API that takes our data to a server, and then when the data we want is ready, then take it to us. Comes back on our phone or computer.

In computer language, API is a way through which he can provide him a medium while developing App through which he can operate easily and give a good experience to the user.

In simple language, it is a communication medium between many software systems. A good API facilitates the application’s communication medium with its speed. That is, it works more quickly, for example, you can see that some applications have good speed and some do not.

API has many types, all types perform different tasks according to individual. Different companies work on their API as per their requirement. Today I will tell you about different types of APIs.it varies depending on a different method, we are showing you the types of APIs depending on the procedure.

1. Procedural:

To complete the special work of this app, the handler of the software i.e. the one who is handling it, goes to the server.

It is mainly provided with a common interface to open a file to the function from its function, then we can do any work through that open fail. Procedural APIs are handled entirely by RPC Implementations.

2. Object-Oriented:

This API is a way to do the difficult tasks in System objects and to make them accessible to the server, it can carry the maximum load.

This API system is faster and more powerful than many other API systems. It also works in the public like many sites and software hits that everyone does, such as the low-grade Search Engines.

3. Service Oriented:

This API where many of the protocols are responsible for making the services and functions that we do through our application, to make them accessible to the server, ie the activities that we do to them Returns the result. This is usually in the merchant department i.e. Shopping, Discount Apps, and Sites. Like Amazon.

4. Resource-Oriented:

By the name of this API, it is known what its name is. As we know that resource means ‘resource’. It also works like this.

When we run software or application, when that API collects our data, it takes it directly to the server. This API uses big companies who want to be completely secure. Expensive web hostings also use this API.

As we know that technology is changing the world, in this way technology like API is also changing, so if the API has to stay in this world for a long time, then its builders will have to make changes according to it. so that it will become even better and people will start using it more.

Since APIs are able to save their time and money to a large extent, I feel that the future of the API is very bright, but its creators will have to constantly change it according to the time and need, otherwise, the day is not far when New technology will take its place.

I sincerely hope that I have given you complete information about what the API is and I hope you all have understood about the Application Programming Interface.