-1

Is resource a mandatory condition in rest API ? for example in a login API "api/v1/login", what will be the resource here. Even though I am using "POST" HTTP method and it's a complete stand alone API, will it be called REST API?

or we have to present it in some other way to make it RESTful.

  • Sounds like your idea of what a "resource" is doesn't match what it actually is. See [this](https://stackoverflow.com/questions/10799198/what-are-rest-resources) for details. – Guy Incognito Dec 05 '20 at 20:17
  • @GuyIncognito thanks for sharing this link. It clears my doubt on the resource. So this leads to me assuming that the URI format has nothing to do with if it is a REST API or not? – Amit Suthar Dec 06 '20 at 07:46
  • @AmitSuthar, you are right. URLs formats are irrelevant for REST APIs, but they are useful for humans. – Evert Dec 06 '20 at 19:24

1 Answers1

0

The REST architectural style, as described by Roy Fielding in 2000, includes a uniform interface constraint

REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.

Resources are a generalization of documents; /api/v1/login would be an identifier for a document, POST /api/v1/login would be a request that some modification be made to the document.


the URI format has nothing to do with if it is a REST API or not?

Exactly right. REST does not care what spelling conventions you use for your resource identifiers (so long as they are consistent with the syntax rules described by RFC 3986).

VoiceOfUnreason
  • 52,766
  • 5
  • 49
  • 91