Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-5485

[Rest API] Endpoint /api/ibexa/v2/product/catalog/products/view returns an error 400 bad request

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None

    Description

      Preconditions:

      • Added product

      Steps to reproduce:

      1. Send a request:
      2.  curl --location '{{yourHOST}}/api/ibexa/v2/product/catalog/products/view' \
        --header 'Accept: application/xml' \
        --header 'Content-Type: application/vnd.ibexa.api.ProductViewInput+xml' \
        --header 'X-CSRF-Token: dad531e62f839e7f4608d4.NcFrciq2_8YE-F6FR5XqrhQqcyHzuG9LkrL84RpH71E.d5soJkTynb49pwfuMcKS7VUdAEKb2x1-6ILRmygNgGNE8i8mQt2gpUaBLQ' \
        --data '<ViewInput>
            <identifier>TitleView</identifier>
            <ProductQuery>
                <limit>10</limit>
                <offset>0</offset>
                <Filter>
                    <FieldCriterion>
                        <name>prod1</name>
                        <operator>like</operator>
                        <value>ibexa*</value>
                    </FieldCriterion>
                </Filter>
                <SortClauses>
                    <ProductName>descending</ProductName>
                </SortClauses>
            </ProductQuery>
        </ViewInput>'
      1. Verify response data.

      Actual result:

      See attached screenshot.

      Endpoint /api/ibexa/v2/product/catalog/products/view returns an error 400 bad request.

      <?xml version="1.0" encoding="UTF-8"?><ErrorMessage media-type="application/vnd.ibexa.api.ErrorMessage+xml">    <errorCode>400</errorCode>    <errorMessage>Bad Request</errorMessage>    <errorDescription>Invalid Criterion id &lt;FieldCriterion&gt; in &lt;AND&gt;</errorDescription>    <trace>#0 /Users/bogdanmazur/flex/flexCommerceMaster45/vendor/ibexa/product-catalog/src/bundle/REST/Input/Parser/Query/Criterion/CriterionProcessor.php(41): Ibexa\Bundle\ProductCatalog\REST\Input\Parser\Query\Criterion\CriterionProcessor-&gt;dispatchCriterion('FieldCriterion', Array, Object(Ibexa\Contracts\Rest\Input\ParsingDispatcher))

      Expected result:

      Status code 200 OK is returned with correct response data.

      NOTE:
      After deep testing we have the same behaviour for Attributes (e.g FloatAttributeCriterion), endpoint returns an error 400 bad request

      For Attribute groups (AttributeGroupIdentifierCriterion) we have an error 500
      example body request:

      <ViewInput>    <identifier>TitleView</identifier>    <ProductQuery>        <limit>10</limit>        <offset>0</offset>        <Filter>            <AttributeGroupIdentifierCriterion>                <name>PT</name>                <operator>like</operator>                <value>ibexa*</value>            </AttributeGroupIdentifierCriterion>        </Filter>        <SortClauses>            <ProductName>descending</ProductName>        </SortClauses>    </ProductQuery></ViewInput>

      response error message:

       <!-- Argument 1 passed to Ibexa\ProductCatalog\Local\Repository\Search\Common\CriterionConverter\LogicalAndCriterionConverter::Ibexa\ProductCatalog\Local\Repository\Search\Common\CriterionConverter\{closure}() must implement interface Ibexa\Contracts\ProductCatalog\Values\Product\Query\CriterionInterface, instance of Ibexa\Contracts\ProductCatalog\Values\AttributeDefinition\Query\AttributeGroupIdentifierCriterion given (500 Internal Server Error) --><!DOCTYPE html><html lang="en">
      <head>    <meta charset="UTF-8" />    <meta name="robots" content="noindex,nofollow" />    <meta name="viewport" content="width=device-width,initial-scale=1" />    <title>Argument 1 passed to        Ibexa\ProductCatalog\Local\Repository\Search\Common\CriterionConverter\LogicalAndCriterionConverter::Ibexa\ProductCatalog\Local\Repository\Search\Common\CriterionConverter\{closure}()        must implement interface Ibexa\Contracts\ProductCatalog\Values\Product\Query\CriterionInterface, instance of        Ibexa\Contracts\ProductCatalog\Values\AttributeDefinition\Query\AttributeGroupIdentifierCriterion given (500        Internal Server Error)</title>

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              bogdan.mazur@ibexa.co Bogdan Mazur
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: