Skip to main content

 API

PageSeeder Web services API documentation

Output format

This document provides some basic explanation about the production of output in a service or servlet response.

XML

PageSeeder services and servlets will all return XML by default. The documentation for the specific service or servlet will list the objects returned but for a detailed description of these objects, see the Element reference.

For example the URL /service/groups/acme-specs/members will return:

<memberships count="1">
    <group id="178"
           name="acme-specs"
           description="ACME project specifications"
           owner="acme"
           access="member"
           common="false"/>
    <membership id="397"
                email-listed="true"
                notification="none"
                status="normal"
                role="manager"
                created="2015-08-20T11:59:36+10:00">
        <member id="1"
                firstname="John"
                surname="Joans"
                username="jjones"
                email="jjones@allette.com.au"
                status="activated">
            <fullname>John Joans</fullname>
        </member>
    </membership>
</memberships>

The details of the membership object are shown in the element reference.

JSON

If a service or servlet has JSON listed as one of the outputs at the top of it's documentation then adding .json to the end of it's URL or the HTTP header Accept:application/json will return JSON format. This returns exactly the same information as the XML but in a different format.

For example the URL /service/groups/acme-specs/members.json will return:

{
  "count":1,
  "group":
    {"id":178,"name":"acme-specs","type":"group","description":"ACME project specifications",
     "owner":"acme","access":"member","common":false
    },
   "memberships":[
     {"id":397,"emailListed":true,"notification":"none",
      "status":"normal","role":"manager","created":"2015-08-20T11:59:36+10:00",
      "member":
        {"id":1,"firstname":"John","surname":"Joans","username":"jjones",
         "email":"jjones@allette.com.au","status":"activated",
         "fullname":"John Joans"
         }
      }
    ]
  }

If an XML attribute contains a hyphen then in JSON the hyphen will be removed and the letter following it will be Capitalized (e.g. `email-listed` becomes `emailListed`).

CSV

If a service or servlet has CSV listed as one of the outputs at the top of its documentation, then adding .csv to the end of its URL or the HTTP header Accept:text/csv will return CSV format. This generally returns only a subset of the information returned by the other formats.

For example the URL /service/groups/acme-specs/members.json will return:

Member ID,First name,Surname,Email,Username,Status,Notification,Role,Created
1,John,Joans,jjones@allette.com.au,jjones,normal,none,manager,2015-08-20 11:59:36

For CSV output, the ‘T’ and the timezone have been removed from date fields for compatibility with Microsoft Excel. If any field values begin with '-' Excel will interpret them as formulas. One way to fix this is to replace all '=' with '' after opening the CSV in Excel.

Created on , last edited on