4

Is there a name for one piece of an API?

For example, say I have an API the offers four services:

getCustomerInfo
setCustomerInfo
getProductInfo
setProductInfo

Then say, I want to tell a colleague:

The API is going to need a fifth webhook?

I know this is an incorrect use of the word webhook.

What is the correct terminology? Thanks!

UPDATE: This might be a duplicate. krishna kanth's answer here: What is an Endpoint? is:

The term Endpoint was initially used for WCF services. Later even though this word is being used synonymous to API resources, REST recommends to call these URI (URI[s] which understand HTTP verbs and follow REST architecture) as "Resource".

In a nutshell, a Resource or Endpoint is kind of an entry point to a remotely hosted application which lets the users to communicate to it via HTTP protocol.

D.S.
  • 103
  • 8

3 Answers3

4

I think the word you're looking for is resource. I also think that getting and setting would be combined under a single resource and the HTTP calls to that resource would define whether you are GETing or PUTing (setting in REST using HTTP).

Omnomnious
  • 313
  • 1
  • 6
  • 19
2

I think in general an API is a set of methods of communication between various software components.

So, I would say: The API is going to need a fifth method?

Wikipedia also defines API and methods here: https://en.wikipedia.org/wiki/Application_programming_interface

  • 1
    Coming from a WebAPI background I like `method` as well. I tend to group my REST APIs into nouns (grouping concept; controller) and verbs (methods of nouns/controllers). – Sam Axe Aug 31 '17 at 17:12
1

Roy Thomas Fielding defines it as Resource Identifier in your dissertation for the degree of Doctor of Philosophy (see Architectural Styles and the Design of Network-based Software Architectures).

According Roy Fielding:

REST uses a resource identifier to identify the particular resource involved in an interaction between components.

I believe you can use the resource identifier /product do handle the product resource and the resource identifier /customer to handle the customer resource. Also, use the appropriated HTTP method to do the desired action. For example:

  • PUT to /product/{id} to edit a product resource identified by {id} (instead of setProductInfo)
  • GET to /product/{id} to return a representation of a product resource identified by {id} (instead of getProductInfo)
Bruno Peres
  • 15,845
  • 5
  • 53
  • 89