If you're in need of a sample REST API URL for testing purposes along with bearer token authentication, you're in the right place. This article will provide you with a free sample REST API URL that includes all the essential endpoints such as GET, POST, PUT, and DELETE.
With this, you'll be able to easily execute operations like insertion, updating, and deletion within your application. Whether you're working with Python, JavaScript (including frameworks like React.js, Angular.js, or Vue.js), or any other platform, this API will seamlessly integrate.
We're offering the same sample for testing bearer token authentication, enabling you to authenticate your application using a bearer token.
The following endpoint is designed to retrieve a bearer token.
It's a simple GET API, To obtain the bearer token, simply open the URL in a web browser.
{ "Success": true, "Error": null, "Data": { "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijc1Yzg2YTA4LTRiYjYtNDIxMi1iYjJiLWU5ZjA1YWIxNzg3MSIsIm5iZiI6MTcwNzQ2NjA2OCwiZXhwIjoxNzA3NDY5NjY4LCJpYXQiOjE3MDc0NjYwNjgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjA2NDYiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjYwNjQ2In0.p8wwJqTyu99dEYVKON9kuzrPRcFCtOfYq3HgCdqWCXc", "Created": "2024-02-09T08:07:48.4568912+00:00", "Expires": "2024-02-09T09:07:48.2207299+00:00" } }
Below is a straightforward GET API that retrieves a list of customers from the database.
The product JSON object comprises fields such as Id, Email, FirstName, LastName, IsMaster, CreatedAt.
{ "Success": true, "Error": null, "Data": [ { "Id": 1, "Email": "[email protected]", "FirstName": "John", "LastName": "Doe", "IsMaster": true, "CreatedAt": "2024-02-17T12:40:14" }, { "Id": 2, "Email": "[email protected]", "FirstName": "Alice", "LastName": "Smith", "IsMaster": true, "CreatedAt": "2024-02-18T12:40:14" }, { "Id": 3, "Email": "[email protected]", "FirstName": "Michael", "LastName": "Johnson", "IsMaster": true, "CreatedAt": "2024-02-19T12:40:14" }, { "Id": 4, "Email": "[email protected]", "FirstName": "Emily", "LastName": "Brown", "IsMaster": true, "CreatedAt": "2024-02-20T12:40:14" }, { "Id": 5, "Email": "[email protected]", "FirstName": "David", "LastName": "Taylor", "IsMaster": true, "CreatedAt": "2024-02-21T12:40:14" }, { "Id": 6, "Email": "[email protected]", "FirstName": "Emma", "LastName": "Wilson", "IsMaster": true, "CreatedAt": "2024-02-22T12:40:14" }, { "Id": 7, "Email": "[email protected]", "FirstName": "James", "LastName": "Martinez", "IsMaster": true, "CreatedAt": "2024-02-23T12:40:14" }, { "Id": 8, "Email": "[email protected]", "FirstName": "Olivia", "LastName": "Anderson", "IsMaster": true, "CreatedAt": "2024-02-25T12:40:14" }, { "Id": 9, "Email": "[email protected]", "FirstName": "William", "LastName": "Lee", "IsMaster": true, "CreatedAt": "2024-02-25T12:40:14" }, { "Id": 10, "Email": "[email protected]", "FirstName": "Sophia", "LastName": "Garcia", "IsMaster": true, "CreatedAt": "2024-02-28T12:40:14" } ] }
The 'IsMaster' field denotes whether the product is a master product or not. Note that update and delete operations cannot be performed on master data. To execute these operations, you'll need to create your own product first, and then proceed accordingly.
If you're also interested in sample login or registration APIs for testing purposes, you can find them within this post.
The following endpoint is designed to fetch customer by their respective IDs. It requires the customer ID as a parameter and subsequently returns the corresponding product details. If the provided ID does not match any customer in the database, an error message will be generated.{ "Success": true, "Error": null, "Data": { "Id": 2, "Email": "[email protected]", "FirstName": "Alice", "LastName": "Smith", "IsMaster": true, "CreatedAt": "2024-02-18T12:40:14" } }
{ "email": "[email protected]", "firstName": "Carry", "lastName": "Ting" }
{ "Success": true, "Error": null, "Data": { "Id": 12, "Email": "[email protected]", "FirstName": "Carry", "LastName": "Ting", "IsMaster": false, "CreatedAt": "2024-03-04T12:04:11.2595699Z" } }
{ "email": "[email protected]", "firstName": "Carry new", "lastName": "Ting new", "id":12 }
{ "Success": true, "Error": null, "Data": { "Id": 12, "Email": "[email protected]", "FirstName": "Carry new", "LastName": "Ting new", "IsMaster": false, "CreatedAt": "2024-03-04T12:04:11.259569" } }
{ "Success": true, "Error": null, "Data": { "Id": 12, "Email": "[email protected]", "FirstName": "Carry new", "LastName": "Ting new", "IsMaster": false, "CreatedAt": "2024-03-04T12:04:11.259569" } }