1 Reply Latest reply on Jan 8, 2020 8:48 AM by pasquale rossiello

    Fetching result on Multiple items using Rest API

    Ronald Lubin Guru

      Hi All,

       

      I am using the below rest API to return result on Multiple items.

       

      http://usXXXXXX10:1512/rest/V1.0/list/Article/byIdentifiers?catalogProxy=US%20Catalog&identifiers=1234567&fields…

       

      According to the doc I can supply multiple identifiers which works.  However, it seems there is a limit on the number of identifiers you can supply because it is using the URL.

       

      Can someone tell me the limit and or is there a better way of doing this.

       

       

      Ron

        • 1. Re: Fetching result on Multiple items using Rest API
          pasquale rossiello Active Member

          Hi Ronald, it can depends from many factors. If you use a REST client utility, it can be a limitation on the URL length, or an URL limitation on the HTTP server infrastructure in PIM. In some case, you can experience the 1k value limitation in the list o values for a IN clause (ORACLE for sure, but I think MS SQL server DB have the same problem), so you can not list more than 1000 values in the list (but you can use OR operator to link more IN clauses, even if not suggested for performance impact).

           

          I suppose you need a REST API approach, so it should not be of help to suggest the usage of PIM SDK for the development. In this case (REST API only approach), only two way are viable:

          1) make more calls, using chunks based on the maximum number of allowed items per call ... or ...

          2) use the bySearch instead of the byIdentifiers, and build a query made of OR linking together IN clauses, every IN clause with no more than 1k items referred in the list of values

           

          .../bySearch?query=Article.SupplierAID IN (VALUE[0][0],VALUE[0][n]) OR Article.SupplierAID IN (VALUE[1][0],VALUE[1][n]) OR ...

           

          where "n" is the maximum allowed values in a list for an IN clause (1000 for Oracle). I am not going to promote "one-single-call" approach at all, but if you need it, this could be a way. Based on my experience, calling k-times the same REST API function passing different set of 1k items (IN clause) could be faster than one single call of k-chunks (OR clause) of 1k items (IN clause).

           

          One is glad to be of service

           

          Pasquale