SlideShare a Scribd company logo
1 of 40
Download to read offline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
VOLGENDE SPREKER
Andra Lungu
API in Magento 2: what you can and you can't do
1
APIinMagento2:
whatyoucanandyoucan'tdo
2
WhoAmi
Andra Lungu - @iamspringerin
Magento Developer @Bitbull_IT
3+ magento development
3+ .net/java development
3
WhY
ERP
SHOPPING
APP
CRM CMS
Javascript
widgets
WAREHOUSE
4
APIinMagento1
Supported Protocols
● XML-RPC
● SOAP V1
● SOAP V2 since M1.3, WS-I compliant since M1.6
● REST since M1.7 with less business logic then others protocols *
Authentication:
● API user with assigned roles similar to ACL roles
● * 3-legged OAuth 1.0a
Documentation
● http://devdocs.magento.com/guides/m1x/api/soap/introduction.html
● http://devdocs.magento.com/guides/m1x/api/rest-api-index.html
5
APIinMagento2
Supported Protocols
● SOAP
● REST
Authentication:
● OAuth 1.0a 2-legged suggested for third-party applications
● Tokens suggested for mobile applications
● Session based
Documentation
● http://devdocs.magento.com/guides/v2.1/rest/bk-rest.html
● http://devdocs.magento.com/guides/v2.1/soap/bk-soap.html
6
AUTHmagento2
User type
● Administrator or Integration
● Customer
● Guest user
Authorized resources. Example if authorized for the
Magento_Customer::group resource, they can make a GET
/V1/customerGroups/:id call.
Resources with anonymous or self permission.
Resources with anonymous permission.
7
AUTHmagento2
acl.xml permissions to access the resources
…...
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Magento_Customer::config_customer" title="Customers Section" translate="title" sortOrder="50" />
</resource>
</resource>
<resource id="Magento_Backend::stores_other_settings">
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="10" />
</resource>
</resource>
……….
8
AUTHmagento2
webapi.xml reference the permission needed for each api resource
<route url="/V1/customers/:email/activate" method="PUT">
<service class="MagentoCustomerApiAccountManagementInterface" method="activate"/>
<resources>
<resource ref="Magento_Customer::manage"/>
</resources>
</route>
<route url="/V1/customers/me/password" method="PUT">
<service class="MagentoCustomerApiAccountManagementInterface" method="changePasswordById"/>
<resources>
<resource ref="self"/>
</resources>
<data>
<parameter name="customerId" force="true">%customer_id%</parameter>
</data>
</route>
<route url="/V1/customers/:customerId/password/resetLinkToken/:resetPasswordLinkToken" method="GET">
<service class="MagentoCustomerApiAccountManagementInterface" method="validateResetPasswordLinkToken"/>
<resources>
<resource ref="anonymous"/>
</resources>
9
OAUTH1.0abasedauth
● Requires implementation of the protocol on client side
● Add integration in the admin area and activate it
10
Tokenbasedauth
curl -X POST "https://magento.host/index.php/rest/V1/integration/customer/token" 
-H "Content-Type:application/json"  -d '{"username":"customer1@example.com",
"password":"customer1pw"}'
authorization: Bearer nj9plnx828w23ppp5u8e0po9sjrkqe0d
11
SeSsionbasedauth
Self access enables a user to access resources they own.
For example, GET /V1/customers/me fetches the logged-in customer's
details typically useful for JavaScript-based widgets.
12
BACKWARDSCOMPATIBILITY
&PHPannotations
Semantic Versioning MAJOR.MINOR.PATCH
● MAJOR indicates incompatible API changes
● MINOR indicates backward-compatible functionality has been added
● PATCH indicates backward-compatible bug fixes
13
BACKWARDSCOMPATIBILITY
&PHPannotations
Backward compatible applies for classes and methods annotated with @api
within MINOR and PATCH updates to our components.
As changes are introduced, methods are annotated with @deprecated and
removed only with the next MAJOR component version.
14
BACKWARDSCOMPATIBILITY
&PHPannotations
Magento uses reflection to automatically create classes and sets data submitted in JSON or HTTP
array syntax onto an instance of the expected PHP class when calling the service method.
Conversely, if an object is returned from one of these methods, Magento automatically converts
that PHP object into a JSON or SOAP object before sending it over the web API.
15
BACKWARDSCOMPATIBILITY
&PHPannotations
All methods exposed by the web API must follow these rules
● Parameters must be defined in the doc block as * @param type $paramName
● Return type must be defined in the doc block as * @return type
● Valid object types include a fully qualified class name or a fully qualified interface name.
● Any parameters or return values of type array can be denoted by following any of the previous types by
an empty set of square brackets []
16
cuSTOMIZEANAPI:
Extension Attributes
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoCatalogApiDataProductInterface">
<attribute code="stock_item" type="MagentoCatalogInventoryApiDataStockItemInterface">
<resources>
<resource ref="Magento_CatalogInventory::cataloginventory"/>
</resources>
</attribute>
</extension_attributes>
</config>
17
CREATEANAPI
18
CREATEANAPI
Never been easier !!!
Bitbull/CustomApi/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="BitbullCustomApiApiMagentoSeminarInterface"
type="BitbullCustomApiModelMagentoSeminar" />
</config>
Bitbull/CustomApi/etc/webapi.xml
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/magentoseminar/:eventName" method="GET">
<service class="BitbullCustomApiApiMagentoSeminarInterface" method="getAwesomeEvent"/>
<resources>
<resource ref="Magento_Catalog::products" />
</resources>
</route>
</routes>
19
CREATEANAPI
Bitbull/CustomApi/Api/MagentoSeminarInterface.php
namespace BitbullCustomApiApi;
/**
* @api
*/
interface MagentoSeminarInterface
{
/**
* Get info about the conference
* @api
* @param string $eventName
* @return string
*/
public function getAwesomeEvent($eventName);
}
20
CREATEANAPI
Bitbull/CustomApi/Model/MagentoSeminar.php
namespace BitbullCustomApiModel;
class MagentoSeminar implements BitbullCustomApiApiMagentoSeminarInterface
{
/*
* @api
* @param string $conferenceName
* @return string
*/
public function getAwesomeEvent($eventName)
{
return $eventName . ' is an awesome event';
}
}
21
QUestions
Thank you

More Related Content

Viewers also liked

Viewers also liked (13)

Marketplace
MarketplaceMarketplace
Marketplace
 
Cefaleas
CefaleasCefaleas
Cefaleas
 
Magento 2 Seminar - Jisse Reitsma - Magento 2 techniek vertalen naar voordelen
Magento 2 Seminar - Jisse Reitsma - Magento 2 techniek vertalen naar voordelenMagento 2 Seminar - Jisse Reitsma - Magento 2 techniek vertalen naar voordelen
Magento 2 Seminar - Jisse Reitsma - Magento 2 techniek vertalen naar voordelen
 
Medscreen Broucher Re
Medscreen Broucher ReMedscreen Broucher Re
Medscreen Broucher Re
 
Keynote - Dun & Bradstreet
Keynote - Dun & BradstreetKeynote - Dun & Bradstreet
Keynote - Dun & Bradstreet
 
Noticias núm. 2 robotica
Noticias núm. 2 roboticaNoticias núm. 2 robotica
Noticias núm. 2 robotica
 
20160106_CV_Morten_Thogersen.docx.
20160106_CV_Morten_Thogersen.docx.20160106_CV_Morten_Thogersen.docx.
20160106_CV_Morten_Thogersen.docx.
 
Aparato digestivo2 (1)
Aparato digestivo2 (1)Aparato digestivo2 (1)
Aparato digestivo2 (1)
 
Paludismo. Iris Guevara
Paludismo. Iris GuevaraPaludismo. Iris Guevara
Paludismo. Iris Guevara
 
Food groups - Year 1
Food groups - Year 1Food groups - Year 1
Food groups - Year 1
 
Life cycle of a plant
Life cycle of a plantLife cycle of a plant
Life cycle of a plant
 
Stages of life
Stages of lifeStages of life
Stages of life
 
Resume milind patil
Resume milind patilResume milind patil
Resume milind patil
 

Similar to Magento 2 Seminar - Roger Keulen - Machine learning

Magento 2 Seminar - Andra Lungu - API in Magento 2
Magento 2 Seminar - Andra Lungu - API in Magento 2Magento 2 Seminar - Andra Lungu - API in Magento 2
Magento 2 Seminar - Andra Lungu - API in Magento 2Yireo
 
7 network programmability concepts python-ansible
7 network programmability concepts python-ansible7 network programmability concepts python-ansible
7 network programmability concepts python-ansibleSagarR24
 
Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0WSO2
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...Jitendra Bafna
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Igor Miniailo
 
The Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfThe Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfConcetto Labs
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture StrategyOCTO Technology
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoMagecom UK Limited
 
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts apiSagarR24
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...Restlet
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts apiSagarR24
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...apidays
 
Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6sumitahuja94
 
RESTful Web Development with CakePHP
RESTful Web Development with CakePHPRESTful Web Development with CakePHP
RESTful Web Development with CakePHPAndru Weir
 
The Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud APIThe Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud APIPromptCloud
 
A_Complete_Guide_to_API_Development.pdf
A_Complete_Guide_to_API_Development.pdfA_Complete_Guide_to_API_Development.pdf
A_Complete_Guide_to_API_Development.pdfPamRobert
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZIgor Miniailo
 

Similar to Magento 2 Seminar - Roger Keulen - Machine learning (20)

Magento 2 Seminar - Andra Lungu - API in Magento 2
Magento 2 Seminar - Andra Lungu - API in Magento 2Magento 2 Seminar - Andra Lungu - API in Magento 2
Magento 2 Seminar - Andra Lungu - API in Magento 2
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
7 network programmability concepts python-ansible
7 network programmability concepts python-ansible7 network programmability concepts python-ansible
7 network programmability concepts python-ansible
 
Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2
 
The Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfThe Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdf
 
REST API Basics
REST API BasicsREST API Basics
REST API Basics
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture Strategy
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor Miniailo
 
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts api
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts api
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6
 
RESTful Web Development with CakePHP
RESTful Web Development with CakePHPRESTful Web Development with CakePHP
RESTful Web Development with CakePHP
 
The Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud APIThe Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud API
 
A_Complete_Guide_to_API_Development.pdf
A_Complete_Guide_to_API_Development.pdfA_Complete_Guide_to_API_Development.pdf
A_Complete_Guide_to_API_Development.pdf
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
 

More from Yireo

Faster Magento Integration Tests
Faster Magento Integration TestsFaster Magento Integration Tests
Faster Magento Integration TestsYireo
 
Mage-OS Nederland
Mage-OS NederlandMage-OS Nederland
Mage-OS NederlandYireo
 
Modernizing Vue Storefront 1
Modernizing Vue Storefront 1Modernizing Vue Storefront 1
Modernizing Vue Storefront 1Yireo
 
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshop
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshopMagento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshop
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshopYireo
 
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2Yireo
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishYireo
 
Magento 2 Seminar - Maarten Schuiling - The App Economy
Magento 2 Seminar - Maarten Schuiling - The App EconomyMagento 2 Seminar - Maarten Schuiling - The App Economy
Magento 2 Seminar - Maarten Schuiling - The App EconomyYireo
 
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2Yireo
 
Magento 2 Seminar - Arjen Miedema - Search Engine Optimisation
Magento 2 Seminar - Arjen Miedema - Search Engine OptimisationMagento 2 Seminar - Arjen Miedema - Search Engine Optimisation
Magento 2 Seminar - Arjen Miedema - Search Engine OptimisationYireo
 
Magento 2 Seminar - Tjitte Folkertsma - Beaumotica
Magento 2 Seminar - Tjitte Folkertsma - BeaumoticaMagento 2 Seminar - Tjitte Folkertsma - Beaumotica
Magento 2 Seminar - Tjitte Folkertsma - BeaumoticaYireo
 
Magento 2 Seminar - Jeroen Vermeulen Snelle Magento 2 Shops
Magento 2 Seminar - Jeroen Vermeulen  Snelle Magento 2 ShopsMagento 2 Seminar - Jeroen Vermeulen  Snelle Magento 2 Shops
Magento 2 Seminar - Jeroen Vermeulen Snelle Magento 2 ShopsYireo
 
Magento 2 Seminar - Christian Muench - Magerun2
Magento 2 Seminar - Christian Muench - Magerun2Magento 2 Seminar - Christian Muench - Magerun2
Magento 2 Seminar - Christian Muench - Magerun2Yireo
 
Magento 2 Seminar - Anton Kril - Magento 2 Summary
Magento 2 Seminar - Anton Kril - Magento 2 SummaryMagento 2 Seminar - Anton Kril - Magento 2 Summary
Magento 2 Seminar - Anton Kril - Magento 2 SummaryYireo
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksYireo
 
Magento 2 Seminar - Ben Marks - Keynote
Magento 2 Seminar - Ben Marks - KeynoteMagento 2 Seminar - Ben Marks - Keynote
Magento 2 Seminar - Ben Marks - KeynoteYireo
 
Magento 2 Seminar - Community agenda
Magento 2 Seminar - Community agendaMagento 2 Seminar - Community agenda
Magento 2 Seminar - Community agendaYireo
 
Magento 2 Seminar - Jisse Reitsma - Migratie Planning
Magento 2 Seminar - Jisse Reitsma - Migratie PlanningMagento 2 Seminar - Jisse Reitsma - Migratie Planning
Magento 2 Seminar - Jisse Reitsma - Migratie PlanningYireo
 
Magento 2 Seminar - Welkom
Magento 2 Seminar - WelkomMagento 2 Seminar - Welkom
Magento 2 Seminar - WelkomYireo
 
Dutch Joomla PHP Developers group - HikaShop Plugin Events
Dutch Joomla PHP Developers group - HikaShop Plugin EventsDutch Joomla PHP Developers group - HikaShop Plugin Events
Dutch Joomla PHP Developers group - HikaShop Plugin EventsYireo
 
Extend Joomla Forms Using Plugins
Extend Joomla Forms Using PluginsExtend Joomla Forms Using Plugins
Extend Joomla Forms Using PluginsYireo
 

More from Yireo (20)

Faster Magento Integration Tests
Faster Magento Integration TestsFaster Magento Integration Tests
Faster Magento Integration Tests
 
Mage-OS Nederland
Mage-OS NederlandMage-OS Nederland
Mage-OS Nederland
 
Modernizing Vue Storefront 1
Modernizing Vue Storefront 1Modernizing Vue Storefront 1
Modernizing Vue Storefront 1
 
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshop
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshopMagento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshop
Magento 2 Seminar - Peter-Jaap Blaakmeer - VR-webshop
 
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2
Magento 2 Seminar - Toon van Dooren - Varnish in Magento 2
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
 
Magento 2 Seminar - Maarten Schuiling - The App Economy
Magento 2 Seminar - Maarten Schuiling - The App EconomyMagento 2 Seminar - Maarten Schuiling - The App Economy
Magento 2 Seminar - Maarten Schuiling - The App Economy
 
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2
Magento 2 Seminar - Sander Mangel - Van Magento 1 naar 2
 
Magento 2 Seminar - Arjen Miedema - Search Engine Optimisation
Magento 2 Seminar - Arjen Miedema - Search Engine OptimisationMagento 2 Seminar - Arjen Miedema - Search Engine Optimisation
Magento 2 Seminar - Arjen Miedema - Search Engine Optimisation
 
Magento 2 Seminar - Tjitte Folkertsma - Beaumotica
Magento 2 Seminar - Tjitte Folkertsma - BeaumoticaMagento 2 Seminar - Tjitte Folkertsma - Beaumotica
Magento 2 Seminar - Tjitte Folkertsma - Beaumotica
 
Magento 2 Seminar - Jeroen Vermeulen Snelle Magento 2 Shops
Magento 2 Seminar - Jeroen Vermeulen  Snelle Magento 2 ShopsMagento 2 Seminar - Jeroen Vermeulen  Snelle Magento 2 Shops
Magento 2 Seminar - Jeroen Vermeulen Snelle Magento 2 Shops
 
Magento 2 Seminar - Christian Muench - Magerun2
Magento 2 Seminar - Christian Muench - Magerun2Magento 2 Seminar - Christian Muench - Magerun2
Magento 2 Seminar - Christian Muench - Magerun2
 
Magento 2 Seminar - Anton Kril - Magento 2 Summary
Magento 2 Seminar - Anton Kril - Magento 2 SummaryMagento 2 Seminar - Anton Kril - Magento 2 Summary
Magento 2 Seminar - Anton Kril - Magento 2 Summary
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
 
Magento 2 Seminar - Ben Marks - Keynote
Magento 2 Seminar - Ben Marks - KeynoteMagento 2 Seminar - Ben Marks - Keynote
Magento 2 Seminar - Ben Marks - Keynote
 
Magento 2 Seminar - Community agenda
Magento 2 Seminar - Community agendaMagento 2 Seminar - Community agenda
Magento 2 Seminar - Community agenda
 
Magento 2 Seminar - Jisse Reitsma - Migratie Planning
Magento 2 Seminar - Jisse Reitsma - Migratie PlanningMagento 2 Seminar - Jisse Reitsma - Migratie Planning
Magento 2 Seminar - Jisse Reitsma - Migratie Planning
 
Magento 2 Seminar - Welkom
Magento 2 Seminar - WelkomMagento 2 Seminar - Welkom
Magento 2 Seminar - Welkom
 
Dutch Joomla PHP Developers group - HikaShop Plugin Events
Dutch Joomla PHP Developers group - HikaShop Plugin EventsDutch Joomla PHP Developers group - HikaShop Plugin Events
Dutch Joomla PHP Developers group - HikaShop Plugin Events
 
Extend Joomla Forms Using Plugins
Extend Joomla Forms Using PluginsExtend Joomla Forms Using Plugins
Extend Joomla Forms Using Plugins
 

Recently uploaded

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 

Recently uploaded (20)

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 

Magento 2 Seminar - Roger Keulen - Machine learning

  • 1. 1
  • 2. 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. 17
  • 18. 18
  • 19. VOLGENDE SPREKER Andra Lungu API in Magento 2: what you can and you can't do
  • 21. 2 WhoAmi Andra Lungu - @iamspringerin Magento Developer @Bitbull_IT 3+ magento development 3+ .net/java development
  • 23. 4 APIinMagento1 Supported Protocols ● XML-RPC ● SOAP V1 ● SOAP V2 since M1.3, WS-I compliant since M1.6 ● REST since M1.7 with less business logic then others protocols * Authentication: ● API user with assigned roles similar to ACL roles ● * 3-legged OAuth 1.0a Documentation ● http://devdocs.magento.com/guides/m1x/api/soap/introduction.html ● http://devdocs.magento.com/guides/m1x/api/rest-api-index.html
  • 24. 5 APIinMagento2 Supported Protocols ● SOAP ● REST Authentication: ● OAuth 1.0a 2-legged suggested for third-party applications ● Tokens suggested for mobile applications ● Session based Documentation ● http://devdocs.magento.com/guides/v2.1/rest/bk-rest.html ● http://devdocs.magento.com/guides/v2.1/soap/bk-soap.html
  • 25. 6 AUTHmagento2 User type ● Administrator or Integration ● Customer ● Guest user Authorized resources. Example if authorized for the Magento_Customer::group resource, they can make a GET /V1/customerGroups/:id call. Resources with anonymous or self permission. Resources with anonymous permission.
  • 26. 7 AUTHmagento2 acl.xml permissions to access the resources …... <acl> <resources> <resource id="Magento_Backend::admin"> <resource id="Magento_Backend::stores"> <resource id="Magento_Backend::stores_settings"> <resource id="Magento_Config::config"> <resource id="Magento_Customer::config_customer" title="Customers Section" translate="title" sortOrder="50" /> </resource> </resource> <resource id="Magento_Backend::stores_other_settings"> <resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="10" /> </resource> </resource> ……….
  • 27. 8 AUTHmagento2 webapi.xml reference the permission needed for each api resource <route url="/V1/customers/:email/activate" method="PUT"> <service class="MagentoCustomerApiAccountManagementInterface" method="activate"/> <resources> <resource ref="Magento_Customer::manage"/> </resources> </route> <route url="/V1/customers/me/password" method="PUT"> <service class="MagentoCustomerApiAccountManagementInterface" method="changePasswordById"/> <resources> <resource ref="self"/> </resources> <data> <parameter name="customerId" force="true">%customer_id%</parameter> </data> </route> <route url="/V1/customers/:customerId/password/resetLinkToken/:resetPasswordLinkToken" method="GET"> <service class="MagentoCustomerApiAccountManagementInterface" method="validateResetPasswordLinkToken"/> <resources> <resource ref="anonymous"/> </resources>
  • 28. 9 OAUTH1.0abasedauth ● Requires implementation of the protocol on client side ● Add integration in the admin area and activate it
  • 29. 10 Tokenbasedauth curl -X POST "https://magento.host/index.php/rest/V1/integration/customer/token" -H "Content-Type:application/json" -d '{"username":"customer1@example.com", "password":"customer1pw"}' authorization: Bearer nj9plnx828w23ppp5u8e0po9sjrkqe0d
  • 30. 11 SeSsionbasedauth Self access enables a user to access resources they own. For example, GET /V1/customers/me fetches the logged-in customer's details typically useful for JavaScript-based widgets.
  • 31. 12 BACKWARDSCOMPATIBILITY &PHPannotations Semantic Versioning MAJOR.MINOR.PATCH ● MAJOR indicates incompatible API changes ● MINOR indicates backward-compatible functionality has been added ● PATCH indicates backward-compatible bug fixes
  • 32. 13 BACKWARDSCOMPATIBILITY &PHPannotations Backward compatible applies for classes and methods annotated with @api within MINOR and PATCH updates to our components. As changes are introduced, methods are annotated with @deprecated and removed only with the next MAJOR component version.
  • 33. 14 BACKWARDSCOMPATIBILITY &PHPannotations Magento uses reflection to automatically create classes and sets data submitted in JSON or HTTP array syntax onto an instance of the expected PHP class when calling the service method. Conversely, if an object is returned from one of these methods, Magento automatically converts that PHP object into a JSON or SOAP object before sending it over the web API.
  • 34. 15 BACKWARDSCOMPATIBILITY &PHPannotations All methods exposed by the web API must follow these rules ● Parameters must be defined in the doc block as * @param type $paramName ● Return type must be defined in the doc block as * @return type ● Valid object types include a fully qualified class name or a fully qualified interface name. ● Any parameters or return values of type array can be denoted by following any of the previous types by an empty set of square brackets []
  • 35. 16 cuSTOMIZEANAPI: Extension Attributes <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> <extension_attributes for="MagentoCatalogApiDataProductInterface"> <attribute code="stock_item" type="MagentoCatalogInventoryApiDataStockItemInterface"> <resources> <resource ref="Magento_CatalogInventory::cataloginventory"/> </resources> </attribute> </extension_attributes> </config>
  • 37. 18 CREATEANAPI Never been easier !!! Bitbull/CustomApi/etc/di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="BitbullCustomApiApiMagentoSeminarInterface" type="BitbullCustomApiModelMagentoSeminar" /> </config> Bitbull/CustomApi/etc/webapi.xml <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> <route url="/V1/magentoseminar/:eventName" method="GET"> <service class="BitbullCustomApiApiMagentoSeminarInterface" method="getAwesomeEvent"/> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> </routes>
  • 38. 19 CREATEANAPI Bitbull/CustomApi/Api/MagentoSeminarInterface.php namespace BitbullCustomApiApi; /** * @api */ interface MagentoSeminarInterface { /** * Get info about the conference * @api * @param string $eventName * @return string */ public function getAwesomeEvent($eventName); }
  • 39. 20 CREATEANAPI Bitbull/CustomApi/Model/MagentoSeminar.php namespace BitbullCustomApiModel; class MagentoSeminar implements BitbullCustomApiApiMagentoSeminarInterface { /* * @api * @param string $conferenceName * @return string */ public function getAwesomeEvent($eventName) { return $eventName . ' is an awesome event'; } }