The ability to get and set the duplicate case numbers in both the plugin APIs and the XML API is currently missing. We have a case open to add it to future versions of those APIs. Please up-vote this question to show your support for adding this feature.
In the meantime, lacking the ability to set the duplicate field, you can create a simple case relation so the cases are at least linked somehow:
Do so by setting the event text to something like 'Automatically closed as a duplicate of case [ixBug]' - then FogBugz will parse the text and add entries to CBugRelation.
Later, when we add control over the duplicate field to the API, you can change to using Duplicate and do a one-time back-fill by parsing the BugEvents of existing cases for the text above and adding the case numbers found as the duplicates.