Kirschi
Kirschi

Reputation: 1118

Accessing single Item/Document in Domino via URL Request

Getting a list of items from a View is pretty easy and also simple to parse as you can get the result as XML or JSON.

GET http://www.acme.com/addresses.nsf/ContactsView?ReadViewEntries

The problem arises when I try to fetch a single Item/Document from this list like

GET http://www.acme.com/addresses.nsf/ContactsView/UNID

It always returns a HTML Page that is hard to parse. Is it possible to get a single item with this method (not with Access Service or Web Service etc.) that is in XML/JSON/etc. format OR is it possible to create a View that can receive and process a parameter and return the specified item? Something like this:

GET http://www.acme.com/addresses.nsf/SpecificItem?ReadViewEntries&fetchId=UNID

This way I would get the item in XML/JSON View. I just would have to define the fields the View should return.

Upvotes: 0

Views: 457

Answers (1)

Emmanuel Gleizer
Emmanuel Gleizer

Reputation: 2018

Your problem is that you are not opening a view but the document with the form when you GET www.acme.com/addresses.nsf/ContactsView/UNID. This is why you get HTML.

You should configure a new form for displaying XML/JSON for the document. You will have to:

  1. code a new form that display the XML or JSON
  2. change the Content-type of the Form (form properties) to other and specify XML or JSON
  3. in the view indicate that document are "opened" with you new form (step1) by using the Form formula of the view.

Upvotes: 2

Related Questions