wiki:WebServices

Version 1 (modified by jim, 6 years ago) (diff)

first draft - initiatives

Web Data Services

This page describes the web services and data provided by the main Transition Network website and the Sharing Engine.

Directory Services

These services provide lists of core ContentTypes? that can be used to prime or update remote caches and clients.

Initiative Directory Service

Returns a list of initiatives with their basic data and geographical coordinate information. See below for an example

ALL initiatives

  • Returns: All initiatives in in the directory - see below for format and example output.
  • Usage: To be used sparingly to prime remote cache of initiative data. Use 7 or 30 day update versions for refreshes. This view is cached for 6 hours to reduce performance impacts on the main site.
  • Service URL: http://www.transitionnetwork.org/transition-services/directories/initiatives/all
  • Parameters: None, only three variations of this view exist - 'all' and updated within 7 or 30 days versions.

Initiatives updated within 30 days

As above except:

Initiatives updated within 7 days

As above except:

Returned fields & sample output

Fields: See ContentTypes? for a full description of the fields

  • nid - node id
  • url - directory page on Transition Network.org
  • title
  • initiative_community_types - multi-select option values
  • initiative_type - single-select option value
  • initiative_status - single-select option value
  • initiative_members_count_estimated - formatted number
  • websites - usually one, potentially several URLs representing the initiative
  • contact_primary_name - formatted string
  • contact_primary_uid - user ID to be used to pull up contact pages on TN.org (thus maintaining privacy)
  • location_city, location_province_name, location_country_name - strings for the address
  • location_latitude, location_longitude - decimal coordinates representing geocoded position of imitative

Example output:

{
  "initiatives" : [
    {
      "initiative" : {
        "nid" : "23",
        "url" : "https://www.transitionnetwork.org/initiatives/totnes",
        "title" : "Totnes",
        "updated" : "2011-01-21T06:54:20+0000",
        "initiative_community_types" : {
          "1" : "Town",
          "2" : "Rural"
        },
        "initiative_type" : "Local Initiative",
        "initiative_status" : "Official",
        "initiative_members_count_estimated" : "3,300",
        "websites" : "http://totnes.transitionnetwork.org",
        "contact_primary_name" : "Lou Brown",
        "contact_primary_uid" : "3516",
        "location_city" : "Totnes",
        "location_province_name" : "Devon",
        "location_country_name" : "United Kingdom",
        "location_latitude" : "50.431213",
        "location_longitude" : "-3.685455"
      }
    },
    [... repeats ...]
  ]
}