4 Replies Latest reply on May 13, 2015 1:21 PM by bas.kuis

    v3 REST API Get Document using only DOC- reference

    MikeBates

      I am converting some Jive 4.5.6 REST API scripts to the Jive 6 based v3 REST API and I am struggling to see how I can get the contents of a Jive document if I only have the DOC-nnnnnnn string as a reference.

       

      Given that I am trying to get the contents of, say, DOC-10001, and my only reference is the string "DOC-10001",

      with the Jive 4.5.6 REST API the request would be GET .../rpc/rest/documentService/documents/DOC-10001

       

      But AFAIKS the equivalent request in the v3 REST API is GET .../contents/{contentid} where {contentid} is an internal object id, and the internal objectid has no obvious relationship with the nnnnnn part of DOC-nnnnnn. For example, our DOC-1002229 has a contentid of "3491"

       

      So, what is the best method to get the {contentid} value if I only have the "DOC-10001" string as an identifier? (preferably using only the v3 REST API). I have tried a search on the string, but curiously a search of "DOC-10001" or "10001" doesn't return any results.

       

      Our use case is that we have a large number (1,000s/10,000s) of Jive documents that have embedded hyperlinks of the form .../docs/DOC-10001 and we need to programatically scan the contents of the linked DOCs.

        • Re: v3 REST API Get Document using only DOC- reference
          MikeBates

          OK, I've figured out how this is done.

           

          If the document I want the contents of is DOC-10001 then the request is GET .../contents?filter=entityDescriptor(102,10001) where the "102" indicates the content type is a document.

          • Re: v3 REST API Get Document using only DOC- reference
            dfiel

            This only works if the internal document ID (10001, internaldocid in the jivedocument table of the DB) is the same as the external document ID (DOC-10001, documentid in the DB).  It generally is the same for new content, but our system has gone through many upgrades and imports, so we have thousands of docs where they do not match.  And I can't even do a brute force search, because the IDs are often thousands apart, both higher and lower.

             

            I have not found a way to do a lookup by DOC-xxxx in API v.3, so I ended up pulling the list of internaldocid's from the DB. 

            • Re: v3 REST API Get Document using only DOC- reference
              bas.kuis

              Hey Mike,

               

              I had the same need. It sounds like you're looking to use the v3 REST api, correct?

              /api/core/v3/contents?filter=entityDescriptor(102,1001)

              The first parameter 102 is the internal type identifier for documents.

              The second parameter 1001 in the example is the document id (as you can find in the url)

               

              I know it's been a while - but I hope this helps somebody else.

               

              Best,

              Bas ~7S