Zed API configuration
Edit on GitHubFirst of all we need to decide on the resources being exposed. Those will be mapped inside the ApiDependencyProvider
:
<?php
namespace Pyz\Zed\Api;
use Spryker\Zed\Api\ApiDependencyProvider as SprykerApiDependencyProvider;
use Spryker\Zed\CustomerApi\Communication\Plugin\Api\CustomerApiResourcePlugin;
use Spryker\Zed\ProductApi\Communication\Plugin\Api\ProductApiResourcePlugin;
class ApiDependencyProvider extends SprykerApiDependencyProvider
{
/**
* @return \Spryker\Zed\Api\Dependency\Plugin\ApiResourcePluginInterface[]
*/
protected function getApiResourcePluginCollection(): array
{
return [
new CustomerApiResourcePlugin(),
new ProductApiResourcePlugin(),
...
];
}
}
Each resource plugin contains a getResourceName()
which will map to the resource name of the URL. Those can also be versioned or customized if necessary.
Example: If you create a CustomerApiResourcePlugin
containing customer-groups
as a resource name, the API resource URL is then API prefix (/api/rest/) + resource name, in this case /api/rest/customer-groups
.
Thank you!
For submitting the form