1 2 Previous Next 15 Replies Latest reply on May 6, 2021 6:40 AM by Vishesh R Simha

    How To: run export profile via API with assortment

    Alex _ Guru

      Hi All,

       

      I want to run an export profile with assortment.

      I have a parameter "Items" that is used for filter items in export. If I run the export profile manually, I'm able to export the feeds.

       

      If I try to run via API, it does not work with the assortment name, nor with the assortment id, nor with the item id list

       

       

      Our requirement is to export the feeds inserting the items list (2 picture)

       

       

      Thanks

      Alessio

        • 1. Re: How To: run export profile via API with assortment
          Stefan Reinhardt Guru

          Hi Alessio,

           

          isn't the right syntax something like this?

           

          "assortmentFilter" : { "id": "4" },

          "updateAssortment" : true

           

          Regards,

            Stefan

          • 2. Re: How To: run export profile via API with assortment
            Alex _ Guru

            Hi Stefan,

             

            how about export specific items?

             

            I want to use the same way to static assortment (1234@1,1235@1) without using a specific assortment.

            • 4. Re: How To: run export profile via API with assortment
              Alex _ Guru

              I don't think that this approch can meet our needs.

               

              For example:

              I have 1 product with 20 items assigned. In my export I set an internal variable "Item" that I use for all dataSource and for each module that have the possibility to filter the items (Product --> items of product (filtered)).

               

              In ActiveVos, I want to export information for the items that I receive into the input message without create assortment.

              • 5. Re: How To: run export profile via API with assortment
                Lokesh Kumar Guru

                Hi Alex

                 

                If you want to pass specific items you can try following report query as sample:

                 

                 

                {

                 

                "profileName":"testexport",

                "dataSources": {

                "Item list" : {

                "reportQuery": {

                "identifier": "byItems",

                "parameters": {

                "items": "1234@1,1235@1"

                }

                }

                }

                }

                }

                Will this work for you ?

                 

                Another way you have mentioned: Passing items as variable and then filtering against whole catalog items (say million) is not a best approach I would feel. Because loading all million items into memory and then filtering for some ofcourse is not a wise approach, rather I can tweak this approach as follows: Create a temp assortment using these items and pass the assortment to export.

                 

                - Lokesh Kumar

                • 6. Re: How To: run export profile via API with assortment
                  Alex _ Guru

                  Hi,

                   

                  the configuration is the following:

                   

                   

                   

                   

                   

                   

                  The Variable Assortment is dynamic in base of the existing assortment but It's possible (from desktop or web ui) export the selected object (static assortment).

                   

                  I want to replicate the behaviour from API

                  • 7. Re: How To: run export profile via API with assortment
                    Alex _ Guru

                    Hi,

                     

                    any updates?

                     

                    Alessio

                    • 8. Re: How To: run export profile via API with assortment
                      Ralph81 Guru

                      Hi Alessio,

                       

                      from the REST Export API I can see

                       

                      Internally, the property assortment of the data source in the export profile is used for the report query. This property has to be set to editable in the data source otherwise it is not possible to specify a report query for that data source. Note that the report query allows to specify an assortment, so it is still possible to specify an assortment.

                      The report query has the following properties:

                      Properties
                      FieldRequiredDefaultDatatypeParameter description
                      identifieryes String

                      Identifier of the report

                      parametersno Map<String,String>Parameters
                      assortmentFilterno ENTITY_ITEM

                      Reference to an assortment (must be a reference object)

                      updateAssortmentno falseBooleanSpecifies if the assortment should be updated before the

                       

                      Examples:

                       

                      1

                       

                      2

                      3

                      4

                      5

                      6

                      7

                      8

                      9

                      10

                      11

                      12

                      13

                      14

                      15

                       

                      {

                       

                          "profileName":"MyExportProfile",

                          "dataSources": {

                              "Item list" : {

                                  "reportQuery": {

                                      "identifier": "bySearch",

                                      "parameters": {

                                          "query": "ArticleLang.DescriptionShort(en) startsWith \"Long live the Export\""

                                      },

                                      "assortmentFilter" : { "id": "4" },

                                      "updateAssortment" : true

                                  }

                              }     

                          }

                      }

                       

                       

                      Hope this helps
                      Best Regards
                      Ralph
                      • 9. Re: How To: run export profile via API with assortment
                        Alex _ Guru

                        Hi Ralph,

                         

                        the problem is that I don't have an assortment in PIM.

                         

                        I want to export the items selected "on the fly".

                        As you can see in my screenshot, I have created a variable of type "Items". This variable is used in input into the field assortment on the data source Items.

                        • 10. Re: How To: run export profile via API with assortment
                          Andreas Bühler Guru

                          You don't need to use an assortment, you can just use the byItems query. In the example above you see the bySearch query. You can use all queries which are also available for the List API GET requests - it's the same piece of code.

                          The query will be evaluated to an item list, THEN the assortment will be applied to this item list. If no assortment is provided with the query, all items of the query are used.

                          The byItems query accepts a list of items.

                          • 11. Re: How To: run export profile via API with assortment
                            Alex _ Guru

                            Hi,

                             

                            yes, but what if I use the Datasource Product by items filtered ?

                            Into the module item of product I want to export the items that I selected before.

                             

                            If the product have 4 items but I select 2 items for start the export, into the product submodule I'll export 4 items.

                             

                             

                            A

                            • 12. Re: How To: run export profile via API with assortment
                              SBeutler New Member

                              Hi Alessio,

                               

                              Unfortunately it is not possible to pass an item assortment or a list of items to an export variable in a Service API call.

                               

                              What I've learned from your description is that you want to run exports with only few items, you want to pass these items by their identifiers and you want to use that list of items as input for a "Item list" data provider as well as filter for the items of products used in a sub-module of products.

                               

                              My suggestion would be the following:

                              • Pass the list of items to the "Item list" data source using a query, e.g. byItems

                              • Collect all item identifiers in your "Item list" main module using ValueSet export function

                              • In the "Items of products" sub-module, check if the current item has been collected in the "Item list" main module, only output data for found items.
                                Note that you have to configure the error classification of ValueGet

                               

                              I hope this helps,

                               

                              Sabine.

                              • 13. Re: How To: run export profile via API with assortment
                                Vishesh R Simha Seasoned Veteran

                                Hi,

                                 

                                What can we do to export the delta records? like records updated after given time. What should be pased in REST API to achieve this

                                 

                                Regards

                                Vishesh R Simha

                                • 14. Re: How To: run export profile via API with assortment
                                  Stefan Reinhardt Guru

                                  Hi Vishesh,

                                   

                                  why wouldn't you setup such a delta export simply as server job? That is the recommended approach to handle it and trying to control it yourself via the API sounds like complicating the use case unless I overlook something here...

                                   

                                  Stefan

                                  1 2 Previous Next