The CRUD and search models of web APIs are implemented through a set of *RepositoryInterface interfaces, found in the <VendorName>/<ModuleName>/Api/<EntityName>RepositoryInterface.php files.
The majority of these repository interfaces define a specific set of common methods:
- save
- get
- getById
- getList
- delete
- deleteById
The data type that flows through these methods follows a certain pattern, where each entity passing through an API has a data interface defined in a <VendorName>/<ModuleName>/Api/Data/<EntityName>Interface.php file.
Let's take a closer look at <MAGENTO_DIR>/module-cms/Api/BlockRepositoryInterface.php:
interface BlockRepositoryInterface
{
public function save(
\Magento\Cms\Api\Data\BlockInterface $block
);
public function getById($blockId);
public function getList(
...