API version 2.2

Version 2.2 is a minor update to Version 2.1, adding an additional parameter to the extended attributes.

Method

json_search_results
Accepts any of the following search parameters:
tx
Free text search, case insensitive (eg "Park")
pc
Postcode, accepts partial postcodes (eg "BS8" or "BS8 111")
st
State, must be one of `open`, `forthcoming` or `closed`
au
Audience, must be one of the audiences configured on the site
in
Interests, must be one of the interests configured on the site
de
Department the consultation sites within. Value must be the same as the ID of a department within the site
ar
Area, must be one of the areas configured on the site
us
Owner, must be on of the users configured on the site
dk
Date search type, must be one of `op` (open date) and `cl` (close date)
fd
Date to search from. Must be used in conjunction with `dk` (dd/mm/yyyy)
td
Date to search until. Must be used in conjunction with `dk` (dd/mm/yyyy)
ct
Consultation type. Must be one of `QuickConsult` (Online Survey), `File` (Email/Postal Consultation), `Document` (Offline Consultation), or `Link` (Link)
fields
Determines what groups of metadata fields about the consultations will be returned. Permissible values are 'basic', 'extended' and 'all'. Omitting this parameter is equivalent to 'basic'.
callback
Used to enable jsonp requests

If no arguments are supplied, all published consultations are returned.
Any unsupported arguments will be ignored.
Returns a JSON structure containing details of each consultation found:
id
The ID of the consultation
title
The title of the consultation
url
The URL of the consultation
status
State: one of `open`, `forthcoming` or `closed`
overview
Overview of the consultation
startdate
The date the consultation opens / opened on
enddate
The date the consultation closes / closed on
department
The department that the consultation belongs to (extended and above)
owner
The full name of the person responsible for the consultation (extended and above)
owner_id
A unique identifier for the person responsible for the consultation (extended and above)
type
The type of consultation (extended and above)
type_string
Human readable type (extended and above)
participation_url
The direct URL to the participation method (survey etc), skipping the overview page (extended and above)
progress
The current state of the consultation (extended and above)
visibility
Either 'public' or 'private' depending on if the consultation has been hidden from end users (extended and above)
audiences
A list of ids for audiences this consultation applies to (all only)
areas
A list of ids for areas this consultation applies to NB: This field is omitted unless area support is installed (all only)
interests
A list of ids for interests this consultation applies to (all only)

Calling via server side code

If you are calling the API methods through server side code, you do not have to worry about the same origin policy: methods may be called via standard HTTP GET requests.

Calling via AJAX / JQuery

To make calls to the API through client side code, you need to use JSONP. This is due to the same origin policy. We use the same callback name as the JQuery default.

            $.getJSON(
                "https://demo.citizenspace.com/api/2.2/methodname?callback=?",
                {
                    'argument': 'value',
                    'argument2': 'value2'
                },
                function(data, textStatus, jqXHR) {
                    // Handle returned data
                }
            );