2 Replies Latest reply on Nov 7, 2012 7:04 AM by boadeveloper

    Syntax of query parameter for osapi.response.data.documents.get

    boadeveloper

      I am creating a process to do a mass delete of documents in one of our spaces.  There are over 6000 documents and I need to delete 2000 of them.  I first do an "osapi.jive.core.spaces.get" using the subspace id. While iterating through the documents (osapi.response.data.documents.get), the more recent documents are pulled first.  I am in need of deleting some of the older documents so I wanted to know if I could use the query parameter to only pull certain documents but I am not sure what needed to go into the query itself.  I did see in another discussion that for the user only part of the user name is needed and the users entire name will be searched for it, similar to a LIKE.  But I haven't seen any other references to this query field.

       

      (Would be great to have more example apps including the parameter fields)

       

      Thanks,

      Patty

        • Re: Syntax of query parameter for osapi.response.data.documents.get

          Would you consider using the searches API instead?

          https://developers.jivesoftware.com/api/v2/js/osapi.jive.core.searches.html

          This might give you some flexibility in what you can ask for, e.g. you can use searchPlaces function.

            • Re: Syntax of query parameter for osapi.response.data.documents.get
              boadeveloper

              Hi Mark,

               

              Would the search function be able to find unpublished documents?  That is the second issue I have run into.  Using the iterative process of finding documents to delete, none of the unpublished documents could be found.

               

              I have 2 sub-spaces with documents that I need to delete.  I want to delete all of the documents in the 1st sub-space.  I want to delete only certain documents in the 2nd sub-space but I want to use the same osapi calls in each space.  I will run the process against the 1st sub-space first since I don't have to worry about accidentally deleting documents so it will in essence be my test.

               

              I created a process to delete the documents in the first sub-space and it was working fine until but it didn't find any of the unpublished documents.  Then when I ran the same process against the 2nd sub-space, I had to read the first 4000 documents before I got to the ones I needed to delete and the process couldn't get to those last 2000 documents.

               

              The last application I wrote, I used the Static Document Get then deleted the document.  I duplicated the code and changed the document ID so it would run 2 deletes back to back in the app. I thought the static calls were not asynchronous but neither document got deleted.  Are those static calls asynchronous?

               

              So to just give you my questions:

               

              1.  Will the Search function, find unpublished documents?

              2.  Are the Static Gets asynchronous calls?


              Thanks,

              Patty