The Best way to Rest
- Ritesh Ranjan
The XML used to make requests and receive responses in SOAP can become extremely complex
Common Object Request Broker Architecture
www.oxford-university.com/students
- API to get list of students
www.oxford-university.com/students
{
"name" : "Jhon",
"deparmemet" : "Arts"
....
}
- Now we need a way to order students by "name" and filter by "department"
- We can create a new API or introduce new parameters
- Same thinking process of creating a way to query this API we will have to think again for other APIs
- Service Root
- Resource Path
- Query Option
- The service document - http://host/service Lists entity sets, functions, and singletons
- The metadata document - http://host/service/$metadata
Describes the types, sets, functions and actions understood by the OData service
- Dynamic resources : The URIs may be computed from the hypermedia information in the service document and metadata.
- Resource operation - Leverages the HTTP verbs, POST, GET, DELETE etc.
DELETE serviceRoot/People
Update an Entity
PATCH serviceRoot/People
- Functions are operations exposed by an OData service that MUST return data and MUST have no observable side effects
- Actions are operations MAY have side effects when invoked.
- Functions and actions both MAY bound to an entity type, primitive type