question

Robyn To avatar image
Robyn To asked

Best practice for moving Catalog from Dev title to Staging title

What's the suggestion for managing economy data between titles? It looks like most of the APIs for management are only for economy v1, I'm looking to develop a simple way for designers to move all items in a catalog from one title to another

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

There isn't a good way to do this right now, but we're working on features to make it easier.

A pseudo-script like this would work.

 foreach (itemA in titleA.SearchItems(...))
 {
   friendlyIdA = itemA.AlternateIds.Get("FriendlyId")
   itemB = titleB.GetItem(fiendlyIdA)
   if (itemB does not exist)
   {
     // clear itemA properties like Id and CreatorEntityKey
     itemB = titleB.CreatDraftItem(itemA)
   }
   else
   {
     // update itemA properties like Id and CreatorEntityKey with values from itemB
     itemB = titleB.UpdateDraftItem(itemA)
   }
   titleB.PublishDraftItem(itemB.Id)  // use GetItemPublishStatus to check for publishing errors
 }
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.