Autocomplete with ishremote

Hi Everybody

How can I autocomplete a publication from ishremote?

Thanks!

Milly

Parents
  • Dear Milly,

    Although there is no separate commandlet available in ISHRemote to autocomplete a baseline, there is a way to achieve this.

    When you create a session using ISHRemote, the created session object can be used as gateway towards the API layer of SDL Tridion Docs.

    So assuming that you create your session object as follows:

    $mySession = New-IshSession -wsBaseUrl https://your.sdltridiondocs.url/ISHWS -PSCredential Get-Credential

    you can access the Baseline25 API functions as follows:

    $mySession.Baseline25.

    From this reference you can trigger the required API method to autocomplete your baseline. So you can use the AutocompleteBaselineByMode method and supply this with the values applicable for your request.

    The API methods are documented in the SDL Documentation portal: https://docs.sdl.com/796504/67982/sdl-tridion-docs-14-sp2/

    Kind Regards,


    Raf

  • Thanks Raf for your prompt answer.

    I was not able to find  AutocompleteBaselineByMode in the documentation for Baseline2.5, but I found CompleteBaselineByCandidateAndMode. I assumed you meant the latter.

    However, I am having a hard time finding the right way to call the method. Here is a snippet of how I am getting the required parameters and then the error message. Could you guide me to the best way to call the method?

    Milly

    ##############################

    # Get the publication in $mypub

    $mypub = Get-IshPublicationOutput -LogicalId $pubID -RequestedMetadata $requestedmeta |
                        Sort-Object -Descending -Property version_version_value |
                        Select-Object -First 1

    # Set arguments for CompleteBaselineByCandidateAndMode
    $pasLanguages = new-object System.Collections.ArrayList($null)
    $pasLanguages.Add("en-US")
    $pasResolutions = new-object System.Collections.ArrayList($null)
    $pasResolutions.Add("VRESLOW")
    # Call method
    $ishSession.Baseline25.CompleteBaselineByCandidateAndMode(
             $mypub.fishbaseline_version_element,
             $mypub.fishmasterref_version_value ,
             "ISHLatestAvailable",
             [System.Collections.ArrayList]@(), # pasStartLogicalIds
             [System.Collections.ArrayList]@(), # pasStartResourceLogicalIds,
             $pasLanguages,
             [System.Collections.ArrayList]@(), # pasIllustrationLanguages,
             [System.Collections.ArrayList]@(), # pasResourceLanguages,
             $pasResolutions)

    ##############################

    Exception calling "CompleteBaselineByCandidateAndMode" with "9" argument(s): "[-102001] The Baseline
    GUID-E05066FF-A538-466D-ADA5-63D114B70959 does not exist. [ce:"GUID-E05066FF-A538-466D-ADA5-63D114B70959"]
    [102001;InvalidObject]"
    At C:\BCD\EFG\Scripts\attempt_autocomplete00.ps1:34 char:1
    + $ishSession.Baseline25.CompleteBaselineByCandidateAndMode(
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : FaultException`1

  • Hi Milly,

    Did you ever get this working? If yes, can you share the working snippet?

Reply Children