How do I query on an extension attribute through the API?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I added an extension attribute to the Invoice class, and I want to be able to query the Invoice database data by my extension attribute.



My extension attribute (ExportedFlag) has these properties





  • entity_id The primary key


  • invoice_id The foreign key to the invoice table.


  • isExported A string value.


When an invoice gets created, it will not have a corresponding row in my extension attribute table. I want to be able to query the database for a list of invoices that don't have a value for the extension attribute, using the API (and then insert the value for that extension attribute).



Here's the code that I have right now that adds the extension attribute to invoices.



public function afterGetList
(
MagentoSalesApiInvoiceRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderInvoiceCollection $searchResult
) {
/** @var MagentoCatalogApiDataInvoiceInterface $invoice */
foreach ($searchResult as $invoice) {
$this->addExportedFlagToInvoice($invoice);
}
return $searchResult;
}

private function addExportedFlagToInvoice(MagentoSalesApiDataInvoiceInterface $invoice)
{
$extensionAttributes = $invoice->getExtensionAttributes();

if (empty($extensionAttributes)) {
$extensionAttributes = $this->invoiceExtensionFactory->create();
}

$exportedFlag = $this->exportedFlagProvider->getExportedFlag($invoice->getEntityId());
$extensionAttributes->setExportedFlag($exportedFlag);
$invoice->setExtensionAttributes($extensionAttributes);

$exportedFlag = $extensionAttributes->getExportedFlag();
$exportedFlag->setInvoiceId($invoice->getEntityId());
$this->entityManager->save($exportedFlag);

return $this;
}


The problem is that this code iterates through each invoice, and adds the extension attribute one-by-one. Furthermore, it retrieves all invoices, regardless of whether or not they have a value for the extension attribute (I don't want to retrieve values that have a row in the extension attributes table).



I want to be able to retrieve all invoices in a single query. Something like this



SELECT *
FROM sales_order_invoice
LEFT OUTER JOIN extensionAttribute
ON sales_order_invoice.entity_id = extensionAttribute.invoice_id
WHERE extensionAttribute.isExported IS NULL


How can I do this within Magento?










share|improve this question





























    1















    I added an extension attribute to the Invoice class, and I want to be able to query the Invoice database data by my extension attribute.



    My extension attribute (ExportedFlag) has these properties





    • entity_id The primary key


    • invoice_id The foreign key to the invoice table.


    • isExported A string value.


    When an invoice gets created, it will not have a corresponding row in my extension attribute table. I want to be able to query the database for a list of invoices that don't have a value for the extension attribute, using the API (and then insert the value for that extension attribute).



    Here's the code that I have right now that adds the extension attribute to invoices.



    public function afterGetList
    (
    MagentoSalesApiInvoiceRepositoryInterface $subject,
    MagentoSalesModelResourceModelOrderInvoiceCollection $searchResult
    ) {
    /** @var MagentoCatalogApiDataInvoiceInterface $invoice */
    foreach ($searchResult as $invoice) {
    $this->addExportedFlagToInvoice($invoice);
    }
    return $searchResult;
    }

    private function addExportedFlagToInvoice(MagentoSalesApiDataInvoiceInterface $invoice)
    {
    $extensionAttributes = $invoice->getExtensionAttributes();

    if (empty($extensionAttributes)) {
    $extensionAttributes = $this->invoiceExtensionFactory->create();
    }

    $exportedFlag = $this->exportedFlagProvider->getExportedFlag($invoice->getEntityId());
    $extensionAttributes->setExportedFlag($exportedFlag);
    $invoice->setExtensionAttributes($extensionAttributes);

    $exportedFlag = $extensionAttributes->getExportedFlag();
    $exportedFlag->setInvoiceId($invoice->getEntityId());
    $this->entityManager->save($exportedFlag);

    return $this;
    }


    The problem is that this code iterates through each invoice, and adds the extension attribute one-by-one. Furthermore, it retrieves all invoices, regardless of whether or not they have a value for the extension attribute (I don't want to retrieve values that have a row in the extension attributes table).



    I want to be able to retrieve all invoices in a single query. Something like this



    SELECT *
    FROM sales_order_invoice
    LEFT OUTER JOIN extensionAttribute
    ON sales_order_invoice.entity_id = extensionAttribute.invoice_id
    WHERE extensionAttribute.isExported IS NULL


    How can I do this within Magento?










    share|improve this question

























      1












      1








      1








      I added an extension attribute to the Invoice class, and I want to be able to query the Invoice database data by my extension attribute.



      My extension attribute (ExportedFlag) has these properties





      • entity_id The primary key


      • invoice_id The foreign key to the invoice table.


      • isExported A string value.


      When an invoice gets created, it will not have a corresponding row in my extension attribute table. I want to be able to query the database for a list of invoices that don't have a value for the extension attribute, using the API (and then insert the value for that extension attribute).



      Here's the code that I have right now that adds the extension attribute to invoices.



      public function afterGetList
      (
      MagentoSalesApiInvoiceRepositoryInterface $subject,
      MagentoSalesModelResourceModelOrderInvoiceCollection $searchResult
      ) {
      /** @var MagentoCatalogApiDataInvoiceInterface $invoice */
      foreach ($searchResult as $invoice) {
      $this->addExportedFlagToInvoice($invoice);
      }
      return $searchResult;
      }

      private function addExportedFlagToInvoice(MagentoSalesApiDataInvoiceInterface $invoice)
      {
      $extensionAttributes = $invoice->getExtensionAttributes();

      if (empty($extensionAttributes)) {
      $extensionAttributes = $this->invoiceExtensionFactory->create();
      }

      $exportedFlag = $this->exportedFlagProvider->getExportedFlag($invoice->getEntityId());
      $extensionAttributes->setExportedFlag($exportedFlag);
      $invoice->setExtensionAttributes($extensionAttributes);

      $exportedFlag = $extensionAttributes->getExportedFlag();
      $exportedFlag->setInvoiceId($invoice->getEntityId());
      $this->entityManager->save($exportedFlag);

      return $this;
      }


      The problem is that this code iterates through each invoice, and adds the extension attribute one-by-one. Furthermore, it retrieves all invoices, regardless of whether or not they have a value for the extension attribute (I don't want to retrieve values that have a row in the extension attributes table).



      I want to be able to retrieve all invoices in a single query. Something like this



      SELECT *
      FROM sales_order_invoice
      LEFT OUTER JOIN extensionAttribute
      ON sales_order_invoice.entity_id = extensionAttribute.invoice_id
      WHERE extensionAttribute.isExported IS NULL


      How can I do this within Magento?










      share|improve this question














      I added an extension attribute to the Invoice class, and I want to be able to query the Invoice database data by my extension attribute.



      My extension attribute (ExportedFlag) has these properties





      • entity_id The primary key


      • invoice_id The foreign key to the invoice table.


      • isExported A string value.


      When an invoice gets created, it will not have a corresponding row in my extension attribute table. I want to be able to query the database for a list of invoices that don't have a value for the extension attribute, using the API (and then insert the value for that extension attribute).



      Here's the code that I have right now that adds the extension attribute to invoices.



      public function afterGetList
      (
      MagentoSalesApiInvoiceRepositoryInterface $subject,
      MagentoSalesModelResourceModelOrderInvoiceCollection $searchResult
      ) {
      /** @var MagentoCatalogApiDataInvoiceInterface $invoice */
      foreach ($searchResult as $invoice) {
      $this->addExportedFlagToInvoice($invoice);
      }
      return $searchResult;
      }

      private function addExportedFlagToInvoice(MagentoSalesApiDataInvoiceInterface $invoice)
      {
      $extensionAttributes = $invoice->getExtensionAttributes();

      if (empty($extensionAttributes)) {
      $extensionAttributes = $this->invoiceExtensionFactory->create();
      }

      $exportedFlag = $this->exportedFlagProvider->getExportedFlag($invoice->getEntityId());
      $extensionAttributes->setExportedFlag($exportedFlag);
      $invoice->setExtensionAttributes($extensionAttributes);

      $exportedFlag = $extensionAttributes->getExportedFlag();
      $exportedFlag->setInvoiceId($invoice->getEntityId());
      $this->entityManager->save($exportedFlag);

      return $this;
      }


      The problem is that this code iterates through each invoice, and adds the extension attribute one-by-one. Furthermore, it retrieves all invoices, regardless of whether or not they have a value for the extension attribute (I don't want to retrieve values that have a row in the extension attributes table).



      I want to be able to retrieve all invoices in a single query. Something like this



      SELECT *
      FROM sales_order_invoice
      LEFT OUTER JOIN extensionAttribute
      ON sales_order_invoice.entity_id = extensionAttribute.invoice_id
      WHERE extensionAttribute.isExported IS NULL


      How can I do this within Magento?







      magento2 database extension-attributes






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Ben RubinBen Rubin

      1878




      1878






















          1 Answer
          1






          active

          oldest

          votes


















          0














          step 1) You may need to create an afterGet function in your invoice plugin class



           public function afterGet
          (
          MagentoSalesApiInvoiceRepositoryInterface $subject,
          MagentoSalesApiDataInvoiceInterface $invoice
          ) {

          $this->addExportedFlagToInvoice($invoice);
          return $invoice;
          }


          Step 2) you can use searchCriteria array on your API request as below



          <?php
          $magentoSiteUrl = 'www.yoursite.com';
          $userData = array("username" => 'USERNAME', "password" => 'PASSWORD');
          define('MAGENTO_SITE_URL',$magentoSiteUrl);
          $ch = curl_init($magentoSiteUrl."/index.php/rest/V1/integration/admin/token");
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
          $token = curl_exec($ch); // get access Token, use it for API c



          //API Search Criteria
          $searchCriteria = 'searchCriteria[filter_groups][2][filters][2][field]=exported_flag&'; // change field name as per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][condition_type]=neq&'; // change condition per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][value]=null'; // change condition value

          $ch = curl_init(MAGENTO_SITE_URL."/index.php/rest/V1/orders/?".$searchCriteria);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($accToken)));
          $result = curl_exec($ch);
          ?>





          share|improve this answer
























          • I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

            – Ben Rubin
            15 hours ago











          • Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

            – Ben Rubin
            15 hours ago












          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269605%2fhow-do-i-query-on-an-extension-attribute-through-the-api%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          step 1) You may need to create an afterGet function in your invoice plugin class



           public function afterGet
          (
          MagentoSalesApiInvoiceRepositoryInterface $subject,
          MagentoSalesApiDataInvoiceInterface $invoice
          ) {

          $this->addExportedFlagToInvoice($invoice);
          return $invoice;
          }


          Step 2) you can use searchCriteria array on your API request as below



          <?php
          $magentoSiteUrl = 'www.yoursite.com';
          $userData = array("username" => 'USERNAME', "password" => 'PASSWORD');
          define('MAGENTO_SITE_URL',$magentoSiteUrl);
          $ch = curl_init($magentoSiteUrl."/index.php/rest/V1/integration/admin/token");
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
          $token = curl_exec($ch); // get access Token, use it for API c



          //API Search Criteria
          $searchCriteria = 'searchCriteria[filter_groups][2][filters][2][field]=exported_flag&'; // change field name as per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][condition_type]=neq&'; // change condition per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][value]=null'; // change condition value

          $ch = curl_init(MAGENTO_SITE_URL."/index.php/rest/V1/orders/?".$searchCriteria);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($accToken)));
          $result = curl_exec($ch);
          ?>





          share|improve this answer
























          • I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

            – Ben Rubin
            15 hours ago











          • Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

            – Ben Rubin
            15 hours ago
















          0














          step 1) You may need to create an afterGet function in your invoice plugin class



           public function afterGet
          (
          MagentoSalesApiInvoiceRepositoryInterface $subject,
          MagentoSalesApiDataInvoiceInterface $invoice
          ) {

          $this->addExportedFlagToInvoice($invoice);
          return $invoice;
          }


          Step 2) you can use searchCriteria array on your API request as below



          <?php
          $magentoSiteUrl = 'www.yoursite.com';
          $userData = array("username" => 'USERNAME', "password" => 'PASSWORD');
          define('MAGENTO_SITE_URL',$magentoSiteUrl);
          $ch = curl_init($magentoSiteUrl."/index.php/rest/V1/integration/admin/token");
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
          $token = curl_exec($ch); // get access Token, use it for API c



          //API Search Criteria
          $searchCriteria = 'searchCriteria[filter_groups][2][filters][2][field]=exported_flag&'; // change field name as per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][condition_type]=neq&'; // change condition per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][value]=null'; // change condition value

          $ch = curl_init(MAGENTO_SITE_URL."/index.php/rest/V1/orders/?".$searchCriteria);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($accToken)));
          $result = curl_exec($ch);
          ?>





          share|improve this answer
























          • I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

            – Ben Rubin
            15 hours ago











          • Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

            – Ben Rubin
            15 hours ago














          0












          0








          0







          step 1) You may need to create an afterGet function in your invoice plugin class



           public function afterGet
          (
          MagentoSalesApiInvoiceRepositoryInterface $subject,
          MagentoSalesApiDataInvoiceInterface $invoice
          ) {

          $this->addExportedFlagToInvoice($invoice);
          return $invoice;
          }


          Step 2) you can use searchCriteria array on your API request as below



          <?php
          $magentoSiteUrl = 'www.yoursite.com';
          $userData = array("username" => 'USERNAME', "password" => 'PASSWORD');
          define('MAGENTO_SITE_URL',$magentoSiteUrl);
          $ch = curl_init($magentoSiteUrl."/index.php/rest/V1/integration/admin/token");
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
          $token = curl_exec($ch); // get access Token, use it for API c



          //API Search Criteria
          $searchCriteria = 'searchCriteria[filter_groups][2][filters][2][field]=exported_flag&'; // change field name as per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][condition_type]=neq&'; // change condition per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][value]=null'; // change condition value

          $ch = curl_init(MAGENTO_SITE_URL."/index.php/rest/V1/orders/?".$searchCriteria);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($accToken)));
          $result = curl_exec($ch);
          ?>





          share|improve this answer













          step 1) You may need to create an afterGet function in your invoice plugin class



           public function afterGet
          (
          MagentoSalesApiInvoiceRepositoryInterface $subject,
          MagentoSalesApiDataInvoiceInterface $invoice
          ) {

          $this->addExportedFlagToInvoice($invoice);
          return $invoice;
          }


          Step 2) you can use searchCriteria array on your API request as below



          <?php
          $magentoSiteUrl = 'www.yoursite.com';
          $userData = array("username" => 'USERNAME', "password" => 'PASSWORD');
          define('MAGENTO_SITE_URL',$magentoSiteUrl);
          $ch = curl_init($magentoSiteUrl."/index.php/rest/V1/integration/admin/token");
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
          $token = curl_exec($ch); // get access Token, use it for API c



          //API Search Criteria
          $searchCriteria = 'searchCriteria[filter_groups][2][filters][2][field]=exported_flag&'; // change field name as per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][condition_type]=neq&'; // change condition per need
          $searchCriteria .= 'searchCriteria[filter_groups][2][filters][2][value]=null'; // change condition value

          $ch = curl_init(MAGENTO_SITE_URL."/index.php/rest/V1/orders/?".$searchCriteria);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($accToken)));
          $result = curl_exec($ch);
          ?>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 18 hours ago









          Pritam Info 24Pritam Info 24

          78417




          78417













          • I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

            – Ben Rubin
            15 hours ago











          • Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

            – Ben Rubin
            15 hours ago



















          • I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

            – Ben Rubin
            15 hours ago











          • Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

            – Ben Rubin
            15 hours ago

















          I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

          – Ben Rubin
          15 hours ago





          I added that afterGet method and I tried issuing my request like http://magento.test/rest/V1/invoices/?searchCriteria[filter_groups][0][filters][0][field]=exportedFlag&searchCriteria[filter_groups][0][filters][0][value]=null&searchCriteria[filter_groups][0][filters][0][condition_type]=neq, but I get the error Column not found: 1054 Unknown column 'exportedFlag' in 'where clause', query was: SELECT main_table.* FROM sales_invoice` AS main_table WHERE ((exportedFlag != 'null'))`

          – Ben Rubin
          15 hours ago













          Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

          – Ben Rubin
          15 hours ago





          Is there a way to tell Magento to join sales_invoice to sales_invoice_exported_flag for these queries?

          – Ben Rubin
          15 hours ago


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269605%2fhow-do-i-query-on-an-extension-attribute-through-the-api%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          What other Star Trek series did the main TNG cast show up in?

          Berlina muro

          Berlina aerponto