The four main HTTP methods (GET, PUT, POST, PATCH and DELETE) can be mapped to CRUD operations as follows:
- GET retrieves the representation of the resource at a specified URI. GET should have no side effects on the server.
- PUT updates a resource at a specified URI. PUT can also be used to create a new resource at a specified URI, if the server allows clients to specify new URIs. For this tutorial, the API will not support creation through PUT.
- PATCH updates data in database (not all fields are required).
- POST creates a new resource. The server assigns the URI for the new object and returns this URI as part of the response message.
- DELETE deletes a resource at a specified URI.
Enabling OData Query Options
Web API supports the following OData query options:
- $expand - Expands related entities inline
- $filter - Filters the results, based on a Boolean condition
- $orderby - Sorts the results
- $select - Selects which properties to include in the response
- $skip - Skips the first n results
- $top - Returns only the first n the results
Using $select, $expand, and $value in Web API
Web API 2 adds support for the $expand, $select, and $value options in OData. These options allow a client to control the representation that it gets back from the server.
$expand causes related entities to be included inline in the response.
$select selects a subset of properties to include in the response.
$value gets the raw value of a property.
List of supported tables is available at instruction.
Web API for nopCommerce 4.00 changed the way of authenticate process. Upgrade is not possible, only set up as new plugin.