Metadata

Method Path Description
GET baseurl/datasets/{dataset_id} Return dataset descriptor. An HTTP 403 is returned when the user has no access to the dataset requested.

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/datasets/s311sr

Sample Response

  {
    "id": "s311sr",
    "displayName": "311 Service Requests",
    "options": { "rendition":{ "icon": "default",
                               "color": "#CD5C5C",
                               "fillColor": "#00FFFF",
                               "opacity": 85,
                               "size": 6,
                               "borderWidth": 3},
                 "latLong": "where.latitude,where.longitude",
                 "creationTimestamp": "when.creation_date",
                 "defaultSort": "{'when.creation_date':-1}",
                 "locationField": "where.location",
                 "addressField": null,
                 "chart": null,
                 "lat": "where.latitude",
                 "long": "where.longitude"
                        },
    "dataSource": null,
    "quickSearch": { "enable": true,
                     "triggerWord": "311sr",
                     "triggerAlias": "311sr",
                     "defaultMax": 6000,
                     "defaultSort": "{'when.creation_date' : -1}",
                     "baseClientFilter": ""
                        },
     "columns":[
                  {
                    "id": "_id",
                    "displayName": "ID",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": false,
                    "list": false,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                 {
                    "id": "what.service_request_number",
                    "displayName": "Service Request Number",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": true,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                 {
                    "id": "when.creation_date",
                    "displayName": "Creation Date",
                    "dataType": "date",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": true,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                 {
                    "id": "what.type",
                    "displayName": "Type",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": true,
                    "xAxis": true,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": "s311_service_request_type",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                 {
                    "id": "what.type_code",
                    "displayName": "Type Code",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.is_legacy",
                    "displayName": "Is Legacy",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": true,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.origin",
                    "displayName": "Origin Type",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": true,
                    "array": false,
                    "listOfValuesId": "s311sr_origin",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.address",
                    "displayName": "Address",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.zip",
                    "displayName": "Zip",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.city",
                    "displayName": "City",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.state",
                    "displayName": "State",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.status",
                    "displayName": "Status",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": true,
                    "xAxis": true,
                    "quickSearch": true,
                    "array": false,
                    "listOfValuesId": "s311sr_status",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "when.completion_date",
                    "displayName": "Completion Date",
                    "dataType": "date",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": true,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.work_orders",
                    "displayName": "Work Orders",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": true,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.description",
                    "displayName": "Description",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.reason",
                    "displayName": "Reason",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": "s311sr_reason",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.priority",
                    "displayName": "Priority",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": "s311sr_priority",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.legacy_service_number",
                    "displayName": "Legacy SR Number",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": false,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.department",
                    "displayName": "Department",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": "s311sr_department",
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "what.is_deleted",
                    "displayName": "Is Deleted",
                    "dataType": "string",
                    "dataSource": null,
                    "filter": true,
                    "popup": true,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.latitude",
                    "displayName": "Latitude",
                    "dataType": "float",
                    "dataSource": null,
                    "filter": false,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    },
                  {
                    "id": "where.longitude",
                    "displayName": "Longitude",
                    "dataType": "float",
                    "dataSource": null,
                    "filter": false,
                    "popup": false,
                    "list": true,
                    "yAxis": false,
                    "xAxis": false,
                    "quickSearch": false,
                    "array": false,
                    "listOfValuesId": null,
                    "format": null,
                    "dotSizer": null,
                    "sortOrder": 0
                    }
                      ],
        }

New in 1.4.0

Two new column properties were introduced as part of the 1.4.0 release: array - a flag to indicate that the column contains array-type values. dotSizer - an object specifying how the dot size will be calculated dynamically. For example, a value like below will calculate the dot size using the given formula depending on the value of this column as represented by the @v token:

    "dotSizer" : { "calculator" : "(Math.sqrt(@v) * 2.5) + 2"}

Query Data

Method Path Description
GET baseurl/datasets/{dataset_id}/query Execute a query against a specific dataset.

Request Parameters

Parameter Value Description
q String Filter expression to use against the specified dataset Pass {} (empty object) to specify ‘no filter’ or leave out this parameter altogether. The query filter must follow the MongoDB query syntax, as with all other API calls that has a query filter parameter. It is recommended that this value be URL encoded.
n Integer The maximum number of records to return; If this parameter is not specified, no records are returned (i.e. default value of 0).
opts JSON String Optional parameters that can be passed depending on service capabilities. This value needs to be encoded for the call to work as expected. "geoFilter" is an attribute supported as of API v1.1.0 and should be a valid geoJson geometry value.

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/datasets/s311sr/query?q=
{"$and":[{"what.description":"Graffiti Removal"}]}&n=6000&opts={"geoFilter":{"type":"MultiPolygon","coordinates":[[[[-87.71947860717773,41.96434063119316],[-87.60257720947266,41.96434063119316],[-87.60257720947266,41.867643341764655],[-87.71947860717773,41.867643341764655],[-87.71947860717773,41.96434063119316]]]]}}

Or when URL encoded:

https://webapps1.chicago.gov/windygrid/#/query?q=%7B%22name%22:%22%22,%22owner%22:%22381404%22,%22spec%22:%5B%7B%22dataSetId%22:%22s311sr%22,%22filters%22:%7B%22condition%22:%22AND%22,%22rules%22:%5B%7B%22id%22:%22what.description%22,%22field%22:%22what.description%22,%22type%22:%22string%22,%22input%22:%22text%22,%22operator%22:%22equal%22,%22value%22:%22Graffiti%20Removal%22%7D%5D%7D,%22rendition%22:%7B%22color%22:%22%2523CD5C5C%22,%22opacity%22:%2285%22,%22size%22:%226%22%7D%7D%5D,%22sharedWith%22:%7B%22users%22:%5B%5D,%22groups%22:%5B%5D%7D,%22isCommon%22:false,%22autoRefresh%22:false,%22refreshInterval%22:%2230%22,%22geoFilter%22:%7B%22boundaryType%22:%22within%22,%22boundary%22:%22_map-extent%22%7D%7D&loc=41.91601030004227,-87.66102790832521,13&run=true&_=1450916334427

Querying Data Using POST Method

Method Path Description
POST baseurl/datasets/{dataset_id}/query Execute a query against a specific dataset. The POST method is now supported to accommodate bigger request payloads primarily due to geo-spatial filters. (Note: WindyGrid services supports geo-spatial filtering)

Request Parameters

The parameter names are the same as the ones on the GET method above except that they should be passed as form data. See sample request payload below.

Sample Request Payload:

------WebKitFormBoundarykJcpgMeB5s6mwbCS
Content-Disposition: form-data; name="q"

{"$and":[{"what.description":"Graffiti Removal"}]}
------WebKitFormBoundarykJcpgMeB5s6mwbCS

Content-Disposition: form-data; name="n"
6000

------WebKitFormBoundarykJcpgMeB5s6mwbCS
Content-Disposition: form-data; name="opts"
        {
            "geoFilter":{"type":"MultiPolygon",
                                "coordinates":[
                            [
                                [           
                                    [-87.71947860717773,41.96434063119316], 
                                    [-87.60257720947266,41.96434063119316],
                                    [-87.60257720947266,41.867643341764655],
                                    [-87.71947860717773,41.867643341764655],
                                    [-87.71947860717773,41.96434063119316]
                                ]
                                        ]
                            ]
                        }
                    }

------WebKitFormBoundarykJcpgMeB5s6mwbCS--

Sample Response

Response for this payload is the same as the GET method sample response above.

List Queries Available to User

Method Path Description
POST baseurl/queries Returns a list of queries that a user has access to. A user has access to all queries created and those shared with any groups assigned to or shared directly by other users.

Request Parameters

Parameter Value Description
q String Filter expression to use to against the specified dataset Pass{}(empty object) to specify ‘no filter’ or leave out this parameter altogether. It is recommended that this value be URL encoded.
n Integer Maximum number of records to return; if this parameter is not specified, no records are returned (i.e. default value of 0).

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/queries?n=1

Sample Response

    [{ "_id":
            {"$oid":"5582f831a3db5f4190e4707a"},
       "name":"Weather Records for 60601",
       "owner":"jsmith",
       "spec":[{"dataSetId":"weather",
                "filters" : {"condition":"AND",
                              "rules":[{"id" : "zipcode",
                                        "field" : "zipcode",
                                        "type" : "string",
                                        "input" : "text",
                                        "operator" : "equal",
                                        "value" : "60601"}]
                                },
                "rendition": {"color": "#DC143C",
                              "opacity": 85,
                              "size": 6 }
                        }],
       "sharedWith": {"users" : [ ],
                      "groups" : [ ]
                        },
        "isCommon" : true
     }]