• HTTP POST problems with JSON / Domino Data Service

    By Kenneth Benjamin 1 decade ago

    I'm developing a web client heavy application that utilizes Domino solely as a JSON REST data store.

    In this process I've discovered a serious problem with HTTP POST and how documents are created in Domino.

    There are two documented URL paths that should permit POST to create a document but only one works.

    POST http://{host}/{database}/api/data/collections/name/{name}?{parameters}

    Fails.

    Documents can be created with this method but, best case, they are empty documents with only the Form property (assuming you pass ?form=myform in the POST URL). Documents created with ?computewithform=true create hidden documents which can only be found via HTTP requests. A Notes client doesn't see them in any view. Deleting these documents can only be achieved via UNID and URL methods.

    POST http://{host}/{database}/api/data/documents?{parameters} 

    Does work as documented and is an alternative.

    Ken

    • The first url has limitations ...

      By Dave Delay 1 decade ago

      Ken,

       

      The first url you mentioned corresponds to the View/folder entries resource.  The POST operation is described here:

       

      http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Viewfolder_entries_POST_dds10

       

      Quote:

       

      "A document created through the view/folder entries resource is limited to those items that appear as column values in the view or folder. Any other items you specify in the request body are ignored. To create an unlimited document, use Document Collection POST."

       

      As you pointed out, you have much more control when creating a document by POSTing to the document collection resource.  If that is working well for you, I'm not sure there is a defect.

       

      By the way, even with the View/folder entries resource, you should be able to get newly created documents to appear in a view.  The trick is usually to use the form and computewithform parameters.  We would need more information to understand why that's not working for you.

       

      Thanks.

       

      -- Dave

      • Profile documents,maybe?

        By Kenneth Benjamin 1 decade ago

        "By the way, even with the View/folder entries resource, you should be able to get newly created documents to appear in a view.  The trick is usually to use the form and computewithform parameters.  We would need more information to understand why that's not working for you.

         

        Dave, Thanks for the answer. I seem to have missed that very important detail in the documentation. That said, the documents created are strange, to say the least.

         

        What I attempted to do was create a document using both form=Profile and computewithform=true. Using computewithform was when I had disappearing documents. Maybe I'm creating Profile docs instead of my own "Profile" form? I hadn't thought of that until just now. That would explain things partly but it doesn't explain why it works with the other URL pattern.

         

        When I tested this theory, I did get strange results but not the invisible documents this time. There is some combination that I've since fixed that causes this. I guess the question is can you create Notes Profile docs via JSON? If so, maybe that's what happens in certain cases. I now have a test database with 832 documents, 829 of which I can't see via any means that I've discovered without knowing the UNID. My guess is they are Notes Profile docs.

         

        FWIW, the view I'm working with is very simple, just a single column with the Author(s) DN in it. My other view just lists the UNID.

         

         

        By the way, the documents created are valid documents. Both fixup and copy-style compacts on the database don't alter the document count.

         

        <font color="#000000" face="Arial, Helvetica, sans-serif">Ken</font></div>