title: Magento 2 - Observer event is not triggering while using REST product API add
body: <p>Below code is used to add product using a REST API. What I want to achieve is after adding product through the webservice I need to call an observer to perform data insertion to another table. </p>
  
  <p>In the website through admin if I saved the product I am able call the observer but in the REST API it is not triggering.</p>
  
  <pre><code>// Post Data of Products
  $sku = uniqid();
  $productData = array(
      'sku'               =&gt; $sku,
      'name'              =&gt; 'Simple Product ' . uniqid(),
      'visibility'        =&gt; 4, /*'catalog',*/
      'type_id'           =&gt; 'simple',
      'price'             =&gt; 0.00,
      'status'            =&gt; 1,
      'attribute_set_id'  =&gt; 9,
      'weight'            =&gt; 1,
      "extension_attributes"=&gt; [
          "stock_item"=&gt; [
              "manage_stock"=&gt; 0,
              "is_in_stock"=&gt; 1,
              "qty"=&gt; "0"
          ]],
      'custom_attributes' =&gt; array(
          array( 'attribute_code' =&gt; 'category_ids', 'value' =&gt; ["3"] ),
          array( 'attribute_code' =&gt; 'description', 'value' =&gt; 'Simple Description' ),
          array( 'attribute_code' =&gt; 'short_description', 'value' =&gt; 'Simple  Short Description' ),
          array( 'attribute_code' =&gt; 'chef_name', 'value' =&gt; 'Rafsan Chef' ),
          array( 'attribute_code' =&gt; 'servings', 'value' =&gt; '2 people' ),
          array( 'attribute_code' =&gt; 'cooking_time', 'value' =&gt; '20 minutes' ),
          array( 'attribute_code' =&gt; 'pdf_upload', 'value' =&gt; '123.pdf' ),
          array( 'attribute_code' =&gt; 'steps', 'value' =&gt; 'step 1 content###Step 2 content###Step3 Content' ),
          )
  );
  
  // creating Product using Magento 2 Rest API
  $productData = json_encode(array('product' =&gt; $productData));
  $ch = curl_init("http://127.0.0.1/magento/index.php/rest/V1/products");
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($ch,CURLOPT_POSTFIELDS, $productData);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
  
  $result = curl_exec($ch);
  
  // the Product is Created using the Above Code 
  
  // i have created an observer in magento for product save after, that observer is working if it is saved from website admin End. but not working while saving through Rest Api. 
  
  // events.xml file created in app/code/[NAMESPACE]/MODULE_NAME/etc/adminhtml/events.xml
  
  &lt;event name="catalog_product_save_after"&gt;
          &lt;observer name="cus_recipe_saveafter" instance="Freshbox\Recipes\Observer\Productsaveafter" /&gt;
  &lt;/event&gt;
  </code></pre>