Creating multiple sub node items with same name in different parent node using commerce service API

Vote:
 

Hi,

I am facing some wired issue while importing catalog and node items using Episerver Commerce service API

Scenario -

My Catalog

  • Node 1
    • Sub node
  • Node 2
    • Sub node
  • Node 3
    • Sub node

I want to create a node name called "Sub node" within different nodes but the API only creates "Sub node" once and returing success for all the node but I am not able to see the other sub nodes.

Any one have any idea on this?

#230245
Nov 02, 2020 15:12
Vote:
 

just to be sure - did you set the sub nodes to have different codes? 

#230246
Nov 02, 2020 15:44
Vote:
 

No, in the current XML the sub-nodes have the same code.

<Node>
        <Name>Cleaners</Name>
        <StartDate>2020-10-24 08:33:00Z</StartDate>
        <EndDate>2030-10-24 08:33:00Z</EndDate>
        <IsActive>true</IsActive>
        <SortOrder>6</SortOrder>
        <DisplayTemplate />
        <Code>Cleaners</Code>
        <MetaData>
          <MetaClass>
            <Name>CatalogNodeEx</Name>
          </MetaClass>
          <MetaFields>
            <MetaField>
              <Name>DisplayName</Name>
              <Type>ShortString</Type>
              <Data language="fr-ca" value="" />
            </MetaField>
            <MetaField>
              <Name>Published</Name>
              <Type>Boolean</Type>
              <Data language="fr-ca" value="true" />
            </MetaField>
            <MetaField>
              <Name>Position</Name>
              <Type>Integer</Type>
              <Data language="fr-ca" value="1" />
            </MetaField>
          </MetaFields>
        </MetaData>
        <ParentNode>Accessories</ParentNode>
        <SeoInfo />
      </Node>
 <Node>
<Node>
        <Name>Cleaners</Name>
        <StartDate>2020-10-24 08:33:00Z</StartDate>
        <EndDate>2030-10-24 08:33:00Z</EndDate>
        <IsActive>true</IsActive>
        <SortOrder>32</SortOrder>
        <DisplayTemplate />
        <Code>Cleaners</Code>
        <MetaData>
          <MetaClass>
            <Name>CatalogNodeEx</Name>
          </MetaClass>
          <MetaFields>
            <MetaField>
              <Name>DisplayName</Name>
              <Type>ShortString</Type>
              <Data language="fr-ca" value="" />
            </MetaField>
            <MetaField>
              <Name>Published</Name>
              <Type>Boolean</Type>
              <Data language="fr-ca" value="true" />
            </MetaField>
            <MetaField>
              <Name>Position</Name>
              <Type>Integer</Type>
              <Data language="fr-ca" value="1" />
            </MetaField>
          </MetaFields>
        </MetaData>
        <ParentNode>Room Air Accessories</ParentNode>
        <SeoInfo />
      </Node>
 <Node>
#230249
Edited, Nov 02, 2020 16:32
Vote:
 

That will not work. Code is the identity of node/entry, so subsequent imports will just override the first one. If you want to have same name but different nodes, you have to have different codes. 

#230251
Nov 02, 2020 16:40
Vote:
 

Oh, I see. Let me try that.

#230254
Nov 02, 2020 17:11
Vote:
 

It worked. Thanks.

One more thing when I try to update any existing node it basically overwrites the node and removes all the other language values.

Like in the below node structure first I create the "Filters" node and then for the second entry I fired the put call but it removed the values of en-us

<Node>
        <Name>Filters</Name>
        <StartDate>2020-10-24 08:30:00Z</StartDate>
        <EndDate>2030-10-24 08:30:00Z</EndDate>
        <IsActive>true</IsActive>
        <SortOrder>2</SortOrder>
        <DisplayTemplate />
        <Code>Filters</Code>
        <MetaData>
          <MetaClass>
            <Name>CatalogNodeEx</Name>
          </MetaClass>
          <MetaFields>
            <MetaField>
              <Name>DisplayName</Name>
              <Type>ShortString</Type>
              <Data language="en-us" value="Filters" />
            </MetaField>
            <MetaField>
              <Name>Published</Name>
              <Type>Boolean</Type>
              <Data language="en-us" value="true" />
            </MetaField>
            <MetaField>
              <Name>Position</Name>
              <Type>Integer</Type>
              <Data language="en-us" value="1" />
            </MetaField>
          </MetaFields>
        </MetaData>
        <ParentNode>Accessories</ParentNode>
        <SeoInfo />
      </Node> 
<Node>
        <Name>Filters</Name>
        <StartDate>2020-10-24 08:33:00Z</StartDate>
        <EndDate>2030-10-24 08:33:00Z</EndDate>
        <IsActive>true</IsActive>
        <SortOrder>2</SortOrder>
        <DisplayTemplate />
        <Code>Filters</Code>
        <MetaData>
          <MetaClass>
            <Name>CatalogNodeEx</Name>
          </MetaClass>
          <MetaFields>
            <MetaField>
              <Name>DisplayName</Name>
              <Type>ShortString</Type>
              <Data language="fr-ca" value="" />
            </MetaField>
            <MetaField>
              <Name>Published</Name>
              <Type>Boolean</Type>
              <Data language="fr-ca" value="true" />
            </MetaField>
            <MetaField>
              <Name>Position</Name>
              <Type>Integer</Type>
              <Data language="fr-ca" value="1" />
            </MetaField>
          </MetaFields>
        </MetaData>
        <ParentNode>Accessories</ParentNode>
        <SeoInfo />
      </Node>
 <Node>
#230340
Nov 04, 2020 10:04
Vote:
 

IIRC it is the default behavior. We talked about how we want to handle it, overwrite, or combine, but no decision has been made. 

#230342
Nov 04, 2020 10:12
Vote:
 

oh :(

so basically I have to merge my XML node first and then create the complete node once. right?

or is there any workaround for this?

#230348
Nov 04, 2020 10:45
Vote:
 

yes, you need to merge the fields yourself

#230350
Nov 04, 2020 11:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.