create api restful code example
Example 1: rest api
1) REQUEST
2) RESPONSE
When we send request, we need to know the API
methods/endpoints that are available:
- read documentation about API methods.
- Swagger tool, that has API methods and descriptions
simple endpoint:
…school.com/api/students
Types of Requests:
GET -> Read data
POST -> Create/insert data
PUT -> Update data
DELETE-> Delete data
I send GET, POST, PUT, DELETE type of API requests to
API endpoint/method and get response.
ORDS (oracle data service) API -> HR Database
ORDS API has methods that we can send request to, and it sends
response with Data from HR database.
Example 2: what is a REST API
An endpoint is one end of a communication channel.
it would be represented as the URL of a server or service.
In REST APIs, the resource typically refers to some object or set of objects
that are exposed at an API endpoint.
An endpoint by itself is just
a reference to a URL that accepts web requests that may or may not be RESTful.