https://mage2gen.com/ יש לסמן את השדה בתוך המודול של API
{
"username":"[email protected]",
"password":"NCJYM7aQ8GJeNz"
}
קבלה של הטוקן ושמירה שלו
מתוך המודול הכתובות מופיעות ב VANDOR/MODULE/etc/webapi.xml
<?xml version="1.0" ?> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> <route url="/V1/api-v1/api_entity" method="POST"> <service class="Api\V1\Api\ApiEntityRepositoryInterface" method="save"/> <resources> <resource ref="Api_V1::api_entity_save"/> </resources> </route> <route url="/V1/api-v1/api_entity/search" method="GET"> <service class="Api\V1\Api\ApiEntityRepositoryInterface" method="getList"/> <resources> <resource ref="Api_V1::api_entity_view"/> </resources> </route> <route url="/V1/api-v1/api_entity/:apiEntityId" method="GET"> <service class="Api\V1\Api\ApiEntityRepositoryInterface" method="get"/> <resources> <resource ref="Api_V1::api_entity_view"/> </resources> </route> <route url="/V1/api-v1/api_entity/:apiEntityId" method="PUT"> <service class="Api\V1\Api\ApiEntityRepositoryInterface" method="save"/> <resources> <resource ref="Api_V1::api_entity_update"/> </resources> </route> <route url="/V1/api-v1/api_entity/:apiEntityId" method="DELETE"> <service class="Api\V1\Api\ApiEntityRepositoryInterface" method="deleteById"/> <resources> <resource ref="Api_V1::api_entity_delete"/> </resources> </route> </routes>
לא לשכוח להוסיף rest לכתובת לדוגמה:
https://magento-642127-2091905.cloudwaysapps.com/rest//V1/api-v1/api_entity/1
בלשונית של authorization לבחור ב bearer Token ולהכניס את הטוקן