How to create events observer that only call when REST api dispatch events?How to obtain a JSON order rendered by the REST API in the sales_order_place_after event observerCall observer function when stock inventory attribute updated programaticallyMagento 2.1.1 Rest API Update price onlyMagento 2 - Category Save Event is not called when save category via rest apiHow to get Product via API right after product created?Magento 2 rest API - How to Manage API Authentication Lifecycle on Mobile Devices Application?REST API - dispatch eventsHow to call dispatch events specific for Mobile?
Is God unknowable?
When does Tiana, Ship's Caretaker check card type?
Plotting octahedron inside the sphere and sphere inside the cube
Understanding the point of a kölsche Witz
Is there a standardised way to check fake news?
Is it feasible to get a hash collision for CRC32, MD-5 and SHA-1 on one file?
How much maintenance time did it take to make an F4U Corsair ready for another flight?
How to reduce Sinas Chinam
The cat ate your input again!
How to disable "Completion time:..." in SQL Server Messages window
Why command hierarchy, if the chain of command is standing next to each other?
If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?
A torrent of foreign terms
How far did Gandalf and the Balrog drop from the bridge in Moria?
TEMPO: play a sound in animated GIF/PDF/SVG
If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?
Why is there a large performance impact when looping over an array over 240 elements?
How can I categorize files in a directory based on their content?
How to describe accents?
A continuous water "planet" ring around a star
Lengthened voiced stops and the airstream through the nose
How can this older-style irrigation tee be replaced?
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
What is this "Table of astronomy" about?
How to create events observer that only call when REST api dispatch events?
How to obtain a JSON order rendered by the REST API in the sales_order_place_after event observerCall observer function when stock inventory attribute updated programaticallyMagento 2.1.1 Rest API Update price onlyMagento 2 - Category Save Event is not called when save category via rest apiHow to get Product via API right after product created?Magento 2 rest API - How to Manage API Authentication Lifecycle on Mobile Devices Application?REST API - dispatch eventsHow to call dispatch events specific for Mobile?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I just want to call an event observer when the event is dispatch via REST API. Like if an order is placed from a mobile application, only then the sales_order_save_after
Observer should be called.
How to write code for same in events.xml
? Or we have to write somewhere else?
magento2 event-observer rest
add a comment |
I just want to call an event observer when the event is dispatch via REST API. Like if an order is placed from a mobile application, only then the sales_order_save_after
Observer should be called.
How to write code for same in events.xml
? Or we have to write somewhere else?
magento2 event-observer rest
add a comment |
I just want to call an event observer when the event is dispatch via REST API. Like if an order is placed from a mobile application, only then the sales_order_save_after
Observer should be called.
How to write code for same in events.xml
? Or we have to write somewhere else?
magento2 event-observer rest
I just want to call an event observer when the event is dispatch via REST API. Like if an order is placed from a mobile application, only then the sales_order_save_after
Observer should be called.
How to write code for same in events.xml
? Or we have to write somewhere else?
magento2 event-observer rest
magento2 event-observer rest
edited 13 hours ago
Daniel
1,0821 gold badge3 silver badges19 bronze badges
1,0821 gold badge3 silver badges19 bronze badges
asked 14 hours ago
Navin BhudiyaNavin Bhudiya
9571 gold badge12 silver badges27 bronze badges
9571 gold badge12 silver badges27 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You have to place a events.xml
in the webapi_rest
area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_rest
directory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
add a comment |
You can declare your observer at following location to call it via REST api only.
app/code/Vendor/Module/etc/webapi_rest/events.xml
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f285144%2fhow-to-create-events-observer-that-only-call-when-rest-api-dispatch-events%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have to place a events.xml
in the webapi_rest
area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_rest
directory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
add a comment |
You have to place a events.xml
in the webapi_rest
area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_rest
directory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
add a comment |
You have to place a events.xml
in the webapi_rest
area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_rest
directory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
You have to place a events.xml
in the webapi_rest
area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_rest
directory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
edited 13 hours ago
answered 14 hours ago
DanielDaniel
1,0821 gold badge3 silver badges19 bronze badges
1,0821 gold badge3 silver badges19 bronze badges
add a comment |
add a comment |
You can declare your observer at following location to call it via REST api only.
app/code/Vendor/Module/etc/webapi_rest/events.xml
add a comment |
You can declare your observer at following location to call it via REST api only.
app/code/Vendor/Module/etc/webapi_rest/events.xml
add a comment |
You can declare your observer at following location to call it via REST api only.
app/code/Vendor/Module/etc/webapi_rest/events.xml
You can declare your observer at following location to call it via REST api only.
app/code/Vendor/Module/etc/webapi_rest/events.xml
answered 14 hours ago
Dinesh YadavDinesh Yadav
4,3941 gold badge9 silver badges38 bronze badges
4,3941 gold badge9 silver badges38 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f285144%2fhow-to-create-events-observer-that-only-call-when-rest-api-dispatch-events%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown