Community articleReceiving a response body
Added by IBM contributorIBM on October 10, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

For a GET operation, the response body contains the requested information in the format of a JSON object or array of objects. For operations other than GET, the response body is typically irrelevant.
See http://www.json.orgexternal link for a complete description of JSON (JavaScript Object Notation). The following sections provide some basic formatting rules. These rules also apply to Specifying a request body.

Note: JSON is the default representation for all services. However, the calendar service also supports iCalendar format.

Elements

An element consists of a name in quotation marks followed by a colon followed by a value as shown below:

"FirstName":"Barney"

An initial at sign in a name indicates system data:

"@unid":"5D006566E919779E852578B7004A6019"

Arrays

An array is delimited by square brackets. Separate elements with commas. The following example shows an array of two date-time values:

"Date":["2011-08-21T20:21:00Z", "2011-08-01T14:38:00Z"]

Objects

An object is delimited by curly brackets. Separate elements with commas. The following example shows an object of three string values:

"Body":{"contentType":"text/html", "data":"Just <b>sales</b>.", "type":"richtext"}}}}
Objects and arrays can be embedded in one another. The following example is an object that represents a document. The object contains an array (the value of the Date element) and another object (the value of the Body element).

{
"FirstName":"Barney",
"LastName":"Bloomberg",
"EMail":"bb@acme.com",
"Number":1.75,
"Date": ["2011-08-21T20:21:00Z", "2011-08-01T14:38:00Z"],
"Body":
{
"contentType":"text/html",
"data":"Just sales.",
"type":"richtext"
},
"City":"New York City"
}


This example is an array of objects that represents information on a document collection.

[
  {
      "@modified":"2011-06-28T15:29:35Z",
      "@unid":"D73CD922E372C494852578B600584F03",
      "@href":"http://ibm-z0shi2lw4cz.swg.usma.ibm.com:80/XPagesExt.nsf/api/data/documents/unid/D73CD922E372C494852578B600584F03"
  },
  {
      "@modified":"2011-06-28T15:29:35Z",
      "@unid":"D1D1114365B55618852578B700499AFD",
      "@href":"http://ibm-z0shi2lw4cz.swg.usma.ibm.com:80/XPagesExt.nsf/api/data/documents/unid/D1D1114365B55618852578B700499AFD"
  },
  {
      "@modified":"2011-06-28T15:29:35Z",
      "@unid":"BC2EA75EBD93E02F852578B7004A15DB",
      "@href":"http://ibm-z0shi2lw4cz.swg.usma.ibm.com:80/XPagesExt.nsf/api/data/documents/unid/BC2EA75EBD93E02F852578B7004A15DB"
  }
]


String values

A string value is enclosed in quotation marks.

"FirstName":"Barney"

Numeric values

A numeric value is a valid number not enclosed in quotation marks.

"Number":1.75

Date-time values

A date-time value is in ISO 8601 format. See http://www.iso.org/iso/date_and_time_formatexternal link.A date-time value can be specified as a string or in strongtype format. A string looks like this:

"Date":"2011-09-21T20:21:00Z"

strongtype format looks like this:

"Date":{"data":"2011-08-21T20:21:00Z", "type":"datetime"}

Rich text values (specific to data service)

A rich text item is in one of two formats: multipart or HTML:
  • Multipart is the default format for rich text items returned in a response body. This format includes the rich text itself and any embedded images and attachments.
  • HTML is a single-part format with links to images and attachments. To read a rich text item in HTML format, specify multipart=false in the GET request URL.

In a request body, you can use either format.

Multipart appears as follows. As shown, documents stored in Notes® CD format have text/plain and text/html parts. Documents stored in native MIME format have a multipart/alternative part only if stored that way. See Document GET and Document collection POST for additional examples.

"Body":
{
"type":"multipart",
"content": [
{
"contentType":"multipart/alternative; Boundary=\"0__=0ABBF330DFE0278A8f9e8a93df938690918c0ABBF330DFE0278A\"",
"contentDisposition":"inline"
}
,
{
"contentType":"text/plain; charset=US-ASCII",
"data":"Mostly sales. Some marketing.",
"boundary":"--0__=0ABBF330DFE0278A8f9e8a93df938690918c0ABBF330DFE0278A"
}
,
{
"contentType":"text/html; charset=US-ASCII",
"contentDisposition":"inline",
"data":"<html><body><font size=\"2\" face=\"sans-serif\">Mostly <\/font><font size=\"2\" face=\"sans-serif\"><b>sales<\/b><\/font><font size=\"2\" face=\"sans-serif\">. Some <\/font><font size=\"2\" face=\"sans-serif\"><i>marketing<\/i><\/font><font size=\"2\" face=\"sans-serif\">.<\/font><\/body><\/html>",
"boundary":"--0__=0ABBF330DFE0278A8f9e8a93df938690918c0ABBF330DFE0278A"
}
]
}
}}}
HTML looks like this. It essentially has one part representing the HTML.

"Body":{"contentType":"text/html", "data":"Just <b>sales</b>.", "type":"richtext"}}}}

Attachments and embedded images (specific to data service)

For multipart format, attachments and embedded images appear as separate parts. See the last two parts in the following rich text example. You can use this format in a request body to create or update rich text items.

"Body":
    {
        "type":"multipart",
        "content":        [
                    {
            "contentType":"multipart/mixed; Boundary=\"0__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36\""
          }
,
                    {
            "contentType":"multipart/related; Boundary=\"1__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36\"",
            "boundary":"--0__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
,
                    {
            "contentType":"multipart/alternative; Boundary=\"2__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36\"",
            "boundary":"--1__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
,
                    {
            "contentType":"text/plain; charset=US-ASCII",
            "contentTransferEncoding":"quoted-printable",
            "data":"\r\nJust sales.\r\nAttachment: (See attached file: image.gif)\r\nLink: (Document link: XPages Extension Library Demo)=\r\n",
            "boundary":"--2__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
,
                    {
            "contentType":"text/html; charset=US-ASCII",
            "contentDisposition":"inline",
            "contentTransferEncoding":"quoted-printable",
            "data":"<html><body><font size=3D\"3\" face=3D\"serif\">Just </font><font size=3D\"3=\r\n\" face=3D\"serif\"><b>sales</b></font><font size=3D\"3\" face=3D\"serif\">.</=\r\nfont><br>\r\n<font size=3D\"3\" face=3D\"serif\">Attachment: </font><i>(See attached fil=\r\ne: image.gif)</i><br>\r\n<font size=3D\"3\" face=3D\"serif\">Link: </font><a href=3D\"Notes://IBM-Z0S=\r\nHI2LW4CZ/852578BD005519C2/CD40A953ABDE036A8525786500660C27/B36433FCF346=\r\n069E852578B7004AAD09\"><img src=3D\"cid:2__=3D0ABBF337DFD4CB368f9e8a93df9=\r\n3869091@local\" border=3D\"0\" alt=3D\"XPages Extension Library Demo\"></a><=\r\n/body></html>=\r\n\r\n",
            "boundary":"--2__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
,
                    {
            "contentType":"image/gif; name=\"doclink.gif\"",
            "contentID":"<2__=0ABBF337DFD4CB368f9e8a93df93869091@local>",
            "contentDisposition":"inline; filename=\"doclink.gif\"",
            "contentTransferEncoding":"base64",
            "data":"R0lGODlhDAAOALMAAAAAAP///7q6w7m5wrW1vf7+/u/v7+Hh4dLS0sDAwLu7u7KysqKiooCAgP//\r\n/wAAACH5BAEAAA4ALAAAAAAMAA4AAARC0MkGmrwXhKbqwtoWBAslAV4zjsBJNuraOuEqu/Z4zPV6\r\nBLzcDxH0BRC7BK2gOx6IiwWqsXAiAVFJyfPEKjFb1CcCADs=\r\n\r\n",
            "boundary":"--1__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
,
                    {
            "contentType":"image/gif; name=\"image.gif\"",
            "contentID":"<1__=0ABBF337DFD4CB368f9e8a93df93869091@local>",
            "contentDisposition":"attachment; filename=\"image.gif\"",
            "contentTransferEncoding":"base64",
            "data":"R0lGODdhIAAgAIMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD/\r\n/////ywAAAAAIAAgAAAE9BDIOY+9GNMNkPdSJmbSB3bbo65su25ICbh03aKordN4vP+v2AQITBGL\r\noZ1hydwdABbbUuAQWJo1TM0g6ApUDkdDwMheaFxBo/GgLhyGxpKmbR24jcVD/3D0qwwHLnUseAZ+\r\nYH9eBoNnLYcLDQ4DCn6WXmV2joVhDw0KY2FhBWOZLIQrh21qrF9wBWSNUY9hrV5wVQ2mK6gqqrle\r\nVHAGBbsqvb6Wnl1hTIGygi6Hh1VWw0vGx5stDLhjd85mszQMDIcF4OU2FlA6B+Xwz+tDRz9G9TUU\r\nPvj5Qvv8LnrMABjQ370jMEqYCDGiocIPHCg0FBFRQgQAOw==\r\n\r\n",
            "boundary":"--0__=0ABBF337DFD4CB368f9e8a93df938690918c0ABBF337DFD4CB36"
          }
 
        ]
 
    }


For HTML format, attachments and embedded images appear as anchor and image HTML elements in a rich text value. The rich text value also contains an attachments element that lists any attachments and embedded images. You cannot use this format in a request body to create or update rich text items.

    "Body":
    {
        "contentType":"text/html",
        "data":"<font size="4">Just </font><b><font size="4">sales</font></b><font size="4">.</font><br />
<font size="4">Attachment: </font>
<a class="domino-attachment-link" style="display: inline-block; text-align: center" href="/XPagesExt.nsf/0/9b2e5f135d47387d852578f4004f8ede/$FILE/image.gif" title="image.gif">
<img src="/XPagesExt.nsf/0/9b2e5f135d47387d852578f4004f8ede/Body/0.E2?OpenElement&FieldElemFormat=gif" width="59" height="34" alt="image.gif" border="0" /><span class="domino-caption" style="display: block">image.gif</span></a><br />
<font size="4">Link: </font>
<a href="/XPagesExt.nsf/cd40a953abde036a8525786500660c27/b36433fcf346069e852578b7004aad09?OpenDocument"><img src="/icons/doclink.gif" border="0" alt="XPages Extension Library Demo" /></a>",
        "attachments":
        ["/XPagesExt.nsf/0/9b2e5f135d47387d852578f4004f8ede/$FILE/image.gif",
"/XPagesExt.nsf/0/9b2e5f135d47387d852578f4004f8ede/Body/0.E2?OpenElement&FieldElemFormat=gif",
"/XPagesExt.nsf/cd40a953abde036a8525786500660c27/b36433fcf346069e852578b7004aad09?OpenDocument",
"/icons/doclink.gif"
        ],
        "type":"richtext"
    }  


Parent topic: Accessing IBM Domino Access Services