How to Freeze a Baseline via the SDL API?

Hi

The team I work on is currently tasked with freezing a baseline for all of the topics in our repository using the SDL API. These are the steps taken so far.

1) Get the baseline name from the publication object via GUID.

2) Use the baseline name to fetch the baseline id.

3) Use the baseline id to freeze the baseline.

The problem is when I try to freeze the baseline I get a false response. The resulting error report states, "No version selected for object". That makes sense, but we are unsure as how exactly select a version (latest version?) for each object attached to the baseline.

Anyone solved this problem, used the API to freeze a baseline?

Any help or pointers we could get would be most welcome.

Thanks,
Keith

  • Hi Keith,

    I'm always interested what the problem is we are trying to solve as inspiration for all of us :-)

    Let's go technical.

    First of all, you can get the baseline id in one go from the publication object by specifying the metadata to retrieve as "<ishfield level='version' name='FISHBASELINE' ishvaluetype='element'/>". The @ishvaluetype attribute defaults to 'value' which is the readable name, but the 'element' value is the real identifier that survives baseline renames.

    When freezing a baseline, the idea is that you will gather a 'super-set' of object versions so that all referenced objects truly have a version assigned. This means that for every starting point in your baseline all versions have to be set for all child branches (typically maps and topics) up to the leaves (typically topics, libraries and images). This including all permutations of condition contexts.
    When reusing that baseline in other publications with most likely a different condition context, any new root map selected from that 'super-set' will offer a complete set of information.

    To put it simple, I would do a Baseline25.CompleteBaselineByCandidateAndMode for the LogicalId of your root map. The latter you can pick up on the publication version level by field FISHMASTERREF. From the top of my head, in that call you can leave ExtendBaselineId empty and put AutoCompleteMode to ISHLatestAvailable - all other parameters can come from your publication version as well.
    The result is a report which you still have to persist into the baseline by a Baseline25.Update call... and then I think a server-side Baseline25.Freeze will work.

    -Dave

  • Hi Dave

    Just wanted to quickly thank you for this. I have a POC and the good news is, it works. I still have some work to do but your suggestion was really helpful.

    Thanks,
    Keith
  • Hi Dave,

    I have a followup question.

    When we create a publication object through our API we get a default, blank baseline. However, when we create a new version of a publication object via the SDL web application (which our editors will be using) we get a very different default baseline. It has all of the objects attached along with their respective version numbers. When we run completeBaselineByCandidateAndMode we do not always get the latest version of each document. I believe this is due to the order of precedence set out here,

    1) The highest version with a Candidate for baseline specified
    2) The version specified in the provided baseline
    3) The version matching the auto complete mode

    We are setting the auto complete mode to latest released but due to rule number 2, we don't always get it.

    Do you know of any way round this issue. Is there a way to remove the elements from the baseline?

    Thanks,
    Keith
  • If you want to mimic what the Client Tools do when creating a new publication version regarding baseline, then... from the top of my head they simply call: Baseline25.Copy before calling PublicationOutput25.Create (passing the newly copied baseline).