Need help? Looking for tips and tricks?

This knowledge base contains loads of useful advice and answers to common questions.

If you're still stuck you can always submit a support request and we'll get back to you ASAP.

API v2.0 Reference

Support -

Overview

Version 2.0 provides the same methods and functionality as Version 1.0, and adds another method which returns JSON data.

If you are calling the API methods through server side code, they should be called via HTTP GET requests, using the following format: 
url_of_citizen_space_instance/api/2.0/methodname?arguments

Methods

In addition to the methods available in Version 1.0, the following method is available:

name:

json_search_results

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: 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 search)

owner: The full name of the person responsible for the consultation (Extended search)

type: The type of consultation (Extended search)

type_string: Human readable type (Extended search)

arguments (typical):

If no arguments are supplied, all published consultations are returned.
Any unsupported arguments will be ignored.

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)

extended: This will return extra information about each consultation, but is slower

callback: Used to enable jsonp requests

example:

$.getJSON(
    "http://www.citizenspace.com/demo/api/2.0/json_search_results?callback=?",
    {
        'tx': 'Police',
        'st': 'open'
    },
        function(data, textStatus, jqXHR) {
        // Handle returned data
    }
);