Use the SDL LiveContent Architect API to download the output of a Publication

How do you use the SDL LiveContent Architect API to download the output of a Publication? 

For example, I want to publish a CHM file of a Publication and then download the output.

I can't seem to find any class or method that will do this. 

Thanks,

Pat

Parents Reply
  • Unfortunately, Python is not my strong suit. I program mostly in java and C#. The java code is fairly extensive in detail. I can send some code samples directly to you if needed, but I've listed the basic logic below. The basic API calls, btw, are the same regardless of asmx vs. svc, though obviously the authentication bits are different.

    1.) Call PublicationOutput25.GetMetaData to get metadata for the publication.
    (You will need to send the authorization context, publication GUID, language combination, output format name, publication version, and requested metadata (can be empty))

    docs.sdl.com/.../pub.xql

    2.) Parse the xml returned from the GetMetaData call

    Get the value of ishobject[@ishlngref]

    3.) Call PublicationOutput25.GetDataObjectInfoByIshLngRef
    (You will need to send the authorization context, and the lngref that you obtained in step 2 above)

    https://docs.sdl.com/LiveContent/web/pub.xql?action=home&pub=SDL%20Knowledge%20Center%20full%20documentation-v2.1.2&lang=en-US#docid=GUID-B3A0D845-D992-444D-B1CE-4267CDA0A865&addHistory=true&query=GetDataObjectInfoByIshLngRef&scope=&tid=b6741009-bdf0-49d7-b047-35445d0af6a2&filename=GUID-B3A0D845-D992-444D-B1CE-4267CDA0A865.xml&resource=&inner_id=&toc=false&eventType=lcContent.loadDocGUID-B3A0D845-D992-444D-B1CE-4267CDA0A865&url=/LiveContent/web/search.xql%3Fc%3Dt%26pub%3DSDL+Knowledge+Center+full+documentation-v2.1.2%26lang%3Den-US%26action%3Dsearch%26query%3DGetDataObjectInfoByIshLngRef&sid=lcSearch.runSearch1481907555400&currentQuery=GetDataObjectInfoByIshLngRef&currentScope=

    4.) Parse the xml returned from the GetDataObjectInfoByIshLngRef call

    Get the following values:

    lngref = ishdataobject[@ishlngref]
    outputGUID = ishdataobject[@ed]
    size = ishdataobject[@size]

    5.) Make successive calls to getNextDataObjectChunkByIshLngRef to get the data from the blob

    docs.sdl.com/.../pub.xql

    This is the tricky part, and hard to explain. In my java code, it looks like this:

    int offsetInt = 0;
    int maxBytesInt = 200000;
    ByteArray myByteArray = new ByteArray(); // This is a special class I created to handle progressively expanding byte arrays
    while (offsetInt < size) { // The size is what you got in step 4 above
    if (offsetInt + maxBytesInt > size) {
    maxBytesInt = size - offsetInt;
    maxBytesInt++;
    }
    byte[] receivedBytes = getNextDataObjectChunkByIshLngRef(authid, lngRef, outputGUID, offsetInt, maxBytesInt); // lngRef is what you got in step 2, outputGUID is what you got in step 4
    myByteArray.add(receivedBytes, receivedBytes.length);
    offsetInt = offsetInt + receivedBytes.length;
    }

    That's pretty much it, and you can then do whatever you want with the byte stream.
    Note that sometimes the PDF byte streams can contain extra nulls that need to be trimmed off before saving out to a file.

Children