Sisältöön | Selaa aloitteita | Ohje | Tulosta

Oikeusministeriö kartoittaa mahdollisia muutostarpeita kansalaisaloitelakiin. Kerro meille näkemyksesi kansalaisaloitteista.

Vastaa kyselyyn ja osallistu keskusteluun! https://www.otakantaa.fi/fi/hankkeet/155/

Open Data API

The Open Data API provides the same information about initiatives as the site's user interface does. This service contains two Open Data access points: one for listing public initiatives and one for details of an individual initiative. Both interfaces support JSON and JSONP formats.

List of Public Initiatives

https://www.kansalaisaloite.fi/api/v1/initiatives

Returns a list of initiatives with Basic properties. Id of an initiative is an URI of initiative details in JSON format.

Parameters offset and limit may be used to restrict the results. Maximum amount of initiatives to return is 50 and default is 20.
The list includes only initiatives with at least 50 support counts by default. This can be changed with minSupportCount.

Results might be ordered with parameter orderBy. Possible values are id, mostTimeLeft, leastTimeLeft, mostSupports, leastSupports, createdNewest and createdOldest.

https://www.kansalaisaloite.fi/api/v1/initiatives&offset=10&limit=10&minSupportCount=100orderBy=mostTimeLeft

Initiative Details

https://www.kansalaisaloite.fi/api/v1/initiatives/{id}

Details of the initiative in JSON format.

Initiative support counts per date

https://www.kansalaisaloite.fi/api/v1/supports-by-date/{id}

List holding date-value pairs presenting the amounts of statements of support the initiative has gathered until yesterday. Is updated nightly.

JSONP

All interfaces support also JSONP format. Callback is given with jsonp parameter. E.g.
https://www.kansalaisaloite.fi/api/v1/initiatives?jsonp=myCallback.

Initiative properties

Example Data Type B = Basic
D = Detail
Description
{ Object Initiative
  "id":"https://www.kansalaisaloite.fi/api/v1/initiatives/1234", String (URI) B URI of this public initiative
  "url":{ Object B URL:s to initiatives public page
    "fi":"https://www.kansalaisaloite.fi/fi/aloite/1234", String B Finnish URL
    "sv":"https://www.kansalaisaloite.fi/sv/initiativ/1234", String B Swedish URL
  },
  "modified":"2012-11-01T13:50:30+02:00", String (xsd:dateTime) B Date and time of last modification
  "state":"ACCEPTED", String (enum) B Initiative state:
ACCEPTED - Initiative has been accepted by Ministry of Justice
DONE - Initiative has been sent to parliament
CANCELED - Initiative has been canceled
  "stateDate":"2012-10-31T17:57:45+02:00", String (xsd:dateTime) B Date and time of last state change
  "supportCount":0, Integer B Amount of statements of support in this service
  "externalSupportCount":500, Integer B Amount of statements of support collected outside this service
  "totalSupportCount":500, Integer B Total amount of statements of support (supportCount + externalSupportCount)
  "sentSupportCount":0, Integer B Amount of statements of support sent to Population Register Center
  "verifiedSupportCount":0, Integer B Amount of statements of support verified by Population Register Center
  "verified":null, String (xsd:date) B Date of resolution by Population Register Center
  "name":{ Object B Name of the initiative in Finnish and/or Swedish
    "fi":"Nimi Suomeksi", String B Name in Finnish
    "sv":null String B Name in Swedish
  },
  "startDate":"2012-10-31", String (xsd:date) B Date when the gathering of statements of support may begin
  "endDate":"2012-11-02", Date when the gathering of statements of support ends (inclusive)
  "proposalType":"LAW", String (enum) B Type of initiative:
LAW - proposal for law
PREPARATION - proposal to start preparing a law
  "primaryLanguage":"fi", String (enum) B Primary language of the initiative
  "financialSupport":false, Boolean B Does this initiative get financial support?
  "financialSupportURL":null, String (URL) B URL of the financial support notification
  "supportStatementsOnPaper":true, Boolean B Are statements of support collected on paper?
  "supportStatementsInWeb":true, Boolean B Are statements of support collected in another web service?
  "supportStatementsRemoved":null, String (xsd:dateTime) B Date and time of support notification removal.
  "proposal":{ Object D Proposal text
    "fi":"Ehdotus suomeksi.", String D Proposal text in Finnish
    "sv":null String D Proposal text in Swedish
  },
  "rationale":{ Object D Rationale of the proposal
    "fi":"Perustelut suomeksi.", String D Rationale in Finnish
    "sv":null String D Rationale in Swedish
  "links":[ Array D Links for further information about this initiative
    { Object D Link details
      "uri":"http://www.om.fi", String (URL) D URL of the link
      "label":"Oikeusministeriö" String D Label of the link in Finnish or Swedish
    }
  ],
  "initiators":[ Array D Initiators of this initiative
    { Object D Initiator details
      "firstNames":"John", String D First names of this initiator
      "lastName":"Doe", String D Last name of this initiator
      "homeMunicipality":{ Object D Home municipality of this initiator
        "fi":"Helsinki", String D Municipality name in Finnish
        "sv":"Helsingfors" String D Municipality name in Swedish
      }
    }
  ],
  "representatives":[ Array D Representatives of this iniative
    { Object D Representative details
      "firstNames":"Jane", String D First names of the representative
      "lastName":"Doe", String D Last name of the representative
      "homeMunicipality":{ Object D Home municipality of the initiator
        "fi":"Helsinki", String D Municipality name in Finnish
        "sv":"Helsingfors" String D Municipality name in Swedish
      },
      "contactInfo":{ Object D Contact information for the representative (one required)
        "email":"firstname lastname  domain fi", String D Email address of the representative. To make spammers lives even little more difficult, "." has been replaced with one and "@" with two whitespace characters
        "phone":"09-123456", String D Phone number of the representative
        "address":"PO BOX 25, FI-00023 Government" String D Contact address of the representative
      }
    }
  ],
  "reserves":[ Object D Reserve representatives of this initiative
    { Object D Reserve representative details
      ... Same format as in representative details
    }
  ],
  },
}