Basics of API
Number of APIs: 1
Basic Information
Documentation: Open Documentation before getting started by hovering over the collection name then clicking 3 dots and selecting documentation in the menu or click here
Endpoint URL: https://api101.up.railway.app/
Paths:
/joke
For working with Jokes API./quote
For working with Quotes API./book
For working with Books API.
All the paths can handle all requests, including GET
, POST
, PUT
, and DELETE
.
Every object must have an id, author, quote/joke/book listed, and the source field is optional.
To access the body of your request, go to the body tab, select the raw button, and select JSON from the dropdown.
Using the API
To use the API, add the following:
- Use
GET
Request to retrieve the information. - Add
POST
Request to add your information. - Add
PUT
Request to update your information. - Add
DELETE
Request to delete the data you added.
Making Requests for Joke API with the /joke
path
{base_url}: https://api101.up.railway.app/
GET
By default, we have six jokes with id [1-6]
To get a random joke: {base_url}/joke
To get a specific joke: {base_url}/joke/{id of joke}
Example: https://api101.up.railway.app/joke/3
(Brackets are not required in the path)
POST
To send a new joke: {base_url}/joke
Add the body to your request in the body
tab and select JSON from the dropdown
This is an example of the body the API accepts. (source is optional)
{
"author": "Ali Mustufa",
"joke": "Bugs are features",
"source": "iali.dev"
}
Default jokes can't be edited or deleted. You will get the id in return which you can use for updating the joke later.
The source is optional, but the rest of the fields are required.
PUT
To update an existing joke: {base_url}/joke
PUT
updates the entire object on the server, so add the updated data in the body of your request. Make sure you change the id to the id you used earlier in the POST
request and make the changes you want in the body before hitting send
.
Example:
{
"id": "",
"author": "Ali Mustufa",
"joke": "Bugs are updated features",
"source": "iali.dev"
}
Make sure you update the id with the id
you got earlier as a response. The source is optional, but the rest of the fields are required.
DELETE
To delete a joke: {base_url}/joke/{id of joke}
(Brackets are not required in the path)
Example: https://api101.up.railway.app/joke/101
Making Requests for Quote API with the /quote
path
{base_url}: https://api101.up.railway.app/
GET
By default, we have 5 quotes with id [1-5]
To get a random quote: {base_url}/quote
To get a specific quote: {base_url}/quote/{id of quote}
(Brackets are not required in the path)
Example: https://api101.up.railway.app/quote/3
POST
To send a new quote or affirmation: {base_url}/quote
In a JSON object, use the following structure:
{
"author": "Ali Mustufa",
"quote": "Change is MUST",
"source": "Ali Mustufa"
}
Default jokes can't be edited or deleted. You will get the id
in return which you can use for updating the quote later.
The source is optional, but the rest of the fields are required.
PUT
To edit or update an existing quote: {base_url}/quote
PUT
updates the entire object on the server, so add the updated data in the body of your request. Make sure you change the id to the id you used earlier in the POST
request and make the changes you want in the body before hitting send
.
Example:
{
"id": "",
"author": "Maya Angelou",
"quote": "You will face many defeats in life, but never let yourself be defeated.",
"source": "2009 Interview"
}
Make sure you update the id with the id
you got earlier as a response. The source is optional, but the rest of the fields are required.
DELETE
To delete a quote: {base_url}/quote/{id of quote}
(Brackets are not required in the path)
Example: https://api101.up.railway.app/quote/3
Making Requests for Book API with the /book
path
{base_url}: https://api101.up.railway.app/
GET
By default, we have four books with id [1-4]
To get a random book: {base_url}/book
To get a specific book: {base_url}/book/{id of quote}
Example: https://api101.up.railway.app/book/3
(Brackets are not required in the path)
POST
To send a new book: {base_url}/book
In a JSON object, use the following structure:
{
"author": "Kiyosaki",
"book_name": "Rich Dad Poor Dad",
"link": "https://www.richdad.com/"
}
Default books can't be edited or deleted. You will get the id
in return which you can use for updating the book details later.
The source is optional, but the rest of the fields are required.
PUT
To update an existing book: {base_url}/book
PUT
updates the entire object on the server, so add the updated data in the body of your request. Make sure you change the id to the id you used earlier in the POST
request and make the changes you want in the body before hitting send
.
Example:
{
"id": ,
"author": "Francesc Miralles and Hector Garcia",
"book_name": "Ikigai: The Japanese Secret to a Long and Happy Life",
"link": "https://g.co/kgs/tk1G8y"
}
Make sure you update the id with the id
you got earlier as a response. The source is optional, but the rest of the fields are required.
DELETE
To delete a book: {base_url}/book/{id of book}
Example: https://api101.up.railway.app/book/4
(Brackets are not required in the path)
Note: This is a beginner-friendly API development tutorial and doesn't follow best practices, such as authentication and security of API.
- Get Data GET {{Add the URL here}}