Granicus Search API - Fields
General Result Structure
When getting results from the API, all results follow a standard form, with the actual data of the results nested within an array called "hits":
{ "took": 20, "timed_out": false, "_shards": { "total": 791, "successful": 791, "failed": 0 }, "hits": { "total": 1980901, "max_score": 1, "hits": [ ] } }
In the above example, the hits array is empty, but you can see that the query "took" 20ms to complete, did not time out, scanned 791 "shards" or index fragments successfully, and found 1980901 total matches for the query. This data is available with every query result, and is used to determine information about the query itself.
The contents of the hits array will be any number of the data types below:
Agency Fields
As mentioned in the Indexes section, agency information is stored within the API just like other data, and in its own index. Agency results will look like the following example:
"_index": "agencies", "_type": "agency", "_id": "42", "_score": 1, "_source": { "video_count": 356, "marker_count": 1812, "last_update": "2011-12-05T00:04:55-08:00", "location": [ 38.5783765, -121.4927973 ], "id": 42, "name": "Sacramento Municipal Utility District", "state": "CA", "site": "smud.granicus.com" }
As you can see in this example from the Sacramento Municipal Utility District, the agency record belongs to the "agencies" index, is of type "agency", has a Granicus numeric ID of 42, and has 365 video files available with 1812 different marker records. You can also see that we have an estimated location for the agency, the site (which is handy when filtering for a specific agency), and that the agency is in California.
Video Fields
Video results represent entire video files, and look like the following example from San Francisco:
"_index": "sanfrancisco.granicus.com", "_type": "video", "_id": "35", "_score": 1, "_source": { "agency_id": 51, "agency_name": "City and County of San Francisco", "state": "CA", "site": "sanfrancisco.granicus.com", "id": 35, "uid": "561b541a-9b97-1028-9b5d-87dec335c022", "name": "Change of Occupancy Requirements", "datetime": "2005-05-06T12:48:34-07:00", "description": "Department of Building Inspection TSD Training March 14, 2005. Change of Occupancy Requirements ", "keywords": [ ], "duration": 3755, "hls": "http://207.7.154.114:1935/OnDemand/_definst_/mp4:sanfrancisco/sanfrancisco_23b7b557997f1dbaf24657d739a80f24.mp4/playlist.m3u8", "rtmp": "rtmp://207.7.154.114/OnDemand/mp4:sanfrancisco/sanfrancisco_23b7b557997f1dbaf24657d739a80f24.mp4", "http": "http://podcache-101.granicus.com/sanfrancisco/sanfrancisco_23b7b557997f1dbaf24657d739a80f24.mp4", "location": [ 37.7749295, -122.4194155 ] }
Marker Fields
Marker results represent a particular point in time within a video file, and look like the following example from San Francisco:
"_index": "sanfrancisco.granicus.com", "_type": "marker", "_id": "107714", "_score": 1, "_source": { "agency_id": 51, "agency_name": "City and County of San Francisco", "state": "CA", "site": "sanfrancisco.granicus.com", "video_id": 4976, "video_uid": "c7cc0ab2-378c-102b-8366-f507402e283b", "video_name": "BOS City Operations and Neighborhood Services", "id": 107714, "uid": "d9da9446-3791-102b-8366-f507402e283b", "name": "3. Gift of Equipment to Fire Department", "datetime": "2008-02-28T13:12:28-08:00", "hls": "http://207.7.154.114:1935/OnDemand/_definst_/mp4:sanfrancisco/sanfrancisco_37dc3810-b255-41b4-bea2-7a4fde6b68a3.mp4/playlist.m3u8", "rtmp": "rtmp://207.7.154.114/OnDemand/mp4:sanfrancisco/sanfrancisco_37dc3810-b255-41b4-bea2-7a4fde6b68a3.mp4", "http": "http://podcache-101.granicus.com/sanfrancisco/sanfrancisco_37dc3810-b255-41b4-bea2-7a4fde6b68a3.mp4", "offset": 149, "location": [ 37.7749295, -122.4194155 ] }