GFG stands for GeeksforGeeks, a site with free written tutorials on REST APIs, and "rest api gfg" means you are looking for its explanation of how REST works. The calm way to use that material is to read one overview first, then build one small request of your own; reading ten pages about REST will not teach you what one working request teaches.

The detail most people miss is that REST is not a tool you install or a library you import. It is a set of conventions for building web services that use ordinary HTTP and plain resource addresses, so any client that can make an HTTP request can talk to a REST API without special software.

What REST Actually Means Before You Read a Tutorial

REST stands for Representational State Transfer. It describes a style of designing web services where each thing your service knows about is a resource with its own address, called a URL. A resource might be a user, an order, a note or a temperature reading.

When a client asks for a resource, the server sends back a representation of it, usually JSON text. The client does not hold a live connection to the server's data. It just asks, receives a copy, and asks again when it needs fresher information.

REST is stateless in the design sense: each request carries everything the server needs to answer it. The server does not have to remember your previous request. That is why scaling is simpler and why each request can be tested on its own.

The Four HTTP Methods You Will See in Every Example

Almost every REST tutorial leads with these methods, and for good reason. They map to the four things you do with data, and the mapping is stable across almost every public API you will meet.

MethodWhat it doesTypical path
GETRead a resource or a list of them/users or /users/42
POSTCreate a new resource/users
PUT or PATCHReplace or partly update a resource/users/42
DELETERemove a resource/users/42

PUT sends a full replacement of the resource. PATCH sends only the fields you want to change. If you only want to correct an email address, PATCH is usually the safer choice because you cannot accidentally blank out fields you forgot to include.

GET requests should not change anything on the server. That rule is what lets a browser, a proxy or a cache repeat a GET safely. If a tutorial shows a GET that deletes a record, treat it as a bad example.

Reading the Status Code Tells You What Went Wrong

Every response carries a three-digit status code. Learning to read it saves more time than any other single habit, because it tells you whether the problem is your request or the server.

  • 200 means the request succeeded and the body has your data.
  • 201 means a resource was created, usually after a POST.
  • 400 means the server could not understand your request, often malformed JSON.
  • 401 means you are not authenticated. 403 means you are authenticated but not allowed.
  • 404 means the path does not exist, which is often a typo in the URL.
  • 429 means you sent requests too quickly and should wait before retrying.
  • 500 means the server failed while handling a valid request.

Read the response body too. Many APIs return a short JSON message explaining a 400 or 422, and that message usually names the field that failed.

A Small Request You Can Build in Ten Minutes

The fastest way to make the concepts stick is to send one request to a public API and read the answer. These steps work with any HTTP client; labels can differ by version and by tool.

  1. Pick a read-only endpoint from a public API's documentation, something like a list of posts or a weather endpoint.
  2. Open your client and create a new request. Set the method to GET.
  3. Paste the full URL, including any version segment such as /v1/.
  4. If the documentation asks for a key, add it as a header rather than in the URL where possible.
  5. Send the request and note the status code first, before reading the body.
  6. Read the JSON carefully. Identify the outer container and the repeating item.
  7. Change the path to request a single item by its identifier, then send again.

Compare the two responses. The list version wraps items in an array. The single-item version returns one object. Seeing that difference once is worth more than a page of description.

Headers, JSON Bodies and Authentication in Practice

Headers carry metadata about your request. Content-Type: application/json tells the server your body is JSON. Accept: application/json tells it what you want back. Missing the first one is a common cause of a 400 on a POST.

A JSON body is a set of key and value pairs inside curly braces. Keys and string values need double quotes. A trailing comma after the last pair is invalid JSON and will be rejected even though it looks harmless.

Authentication usually comes as a token in a header, often Authorization. Treat that token like a password. Do not paste it into shared documents, screenshots or public code, and do not commit it to a shared repository.

Pagination matters once a list grows. Most APIs return a limited page by default, typically 10 to 100 items, and accept parameters such as page and per_page or a cursor value. If your count seems low, check whether you received only the first page.

The Clearest Misconception: REST Is Not the Same as HTTP

Many beginners read that a REST API uses HTTP and conclude that any HTTP service is REST. That is not true. HTTP is the transport, the set of rules for sending requests and responses. REST is a design style layered on top of it.

The correct fact is that an API can speak HTTP and still not be RESTful, for example if every action is a POST to a single path like /doThing. A REST API gives each resource its own address and uses the methods to say what to do with it.

A second misconception is that REST requires XML. The style does not demand any format. JSON is simply the most common choice because it is short and readable.

What to Do When Your First Request Fails

Work through the request in a fixed order and the cause usually appears within a minute or two.

  1. Check the method. A GET to a path that only accepts POST returns an error that looks like a routing problem.
  2. Check the URL for a missing slash, a wrong version segment or a stray space.
  3. Re-read the status code and the response body before changing anything else.
  4. Validate the JSON body by formatting it in a text editor that shows syntax errors.
  5. Confirm the header names are spelled exactly as the documentation shows.
  6. Try the same request with the tool's plain text view so you see the raw response.

If the response is a 401 after you added a key, the key may be expired or sent in the wrong place. If it is a 404 on a path copied from a tutorial, the tutorial may describe an older version of the API. Check the current documentation rather than guessing at paths.

How to Keep Learning Without Getting Lost

Choose one public API and stay with it for a week. Read its documentation end to end once, then write down the base URL, the authentication method, the list of resources and the pagination rule on a single sheet of paper.

Then build something small: fetch a list, print one field, filter the list, then fetch one item by its identifier. Each of those steps teaches a separate idea, and none of them needs a framework.

Only after one request works end to end should you look at client libraries. A library hides the request details, which is helpful later and confusing at the start. Knowing what the raw request looks like means you can debug anything built on top of it.

Keep the documentation open beside you. Even people who work with APIs daily check the exact parameter names before sending, because a misspelled parameter is silently ignored by many servers rather than reported as an error.