City of Oklahoma City

Open Data Portal

City of Oklahoma City ©

Welcome to the the City of Oklahoma City Open Data Portal developers API page. This page shows the available developer endpoints for consuming data directly from this portal. With these endpoints, you can include our data on your own maps or with in your own applications.


If you prefer to simply embed our data, please see the Embed tab within our Data Viewer for the dataset of interest.


Click here to see all of the available dataset in our Data Catalog.


Data (Records) API

Provides access to data record information in either XML or JSON format. If no dataset (id) is provided, an array of available datasets is returned. This API supports both HTTP Get and Post methods.

HTTP Get provides simple record access of entire dataset or a single record.

HTTP Post supports all of HTTP Get options and also provides additional query options for sorting, attribute queries, and spatial queries. When using HTTP Post the request body should be submitted as a JSON object, with the content-type header set to text/json.

Syntax:

https://data.okc.gov/services/portal/api/data/records/[ID] ? [option1=value]
& [option2=value]
...
& [optionN=value]

Option

Method

Values

Default

Required

Notes

ID get string optional Name of dataset to return records for.
recordID get integer -1 optional When set, returns a single dataset record. Record ID is equivalent to the Object_ID field. For all records, set RecordID = -1.
schemaOnly get true
false
false optional When set to true, only dataset schema information is returned.
orderByField post string optional Name of field to sort results by.
ascending post true
false
true optional Use in conjunction with the OrderByField option to specify sort direction.
spatialFilter post string optional Spatial filter (intersection) to apply to dataset. Geometry should be supplied as OGC Well Known Text (WKT).
bufferDistance post floag 0 optional Use in conjunction with the SpatialFilter option to buffer supplied geometry prior to dataset comparison. Buffer distance should be supplied in feet.
filterField post string optional Name of field to apply an attribute filter.
fitlerType post equal
notequal
like
notlike
in
notin
equal optional Use in conjunction with FilterField to specify the type of attribute comparison to use.
filterValue post string optional Use in conjunction with FilterField and FilterType to specify a value or array of values (in or notin) for an attribute filter.

Examples (HTTP GET)


https://data.okc.gov/services/portal/api/data/records
https://data.okc.gov/services/portal/api/data/records/schools
https://data.okc.gov/services/portal/api/data/records/schools?schemaOnly=true
https://data.okc.gov/services/portal/api/data/records/schools?recordID=3

Examples (HTTP POST)


https://data.okc.gov/services/portal/api/data/records/schools
{"SpatialFilter":"POLYGON((2121666 183401, 2121667 182592, 2122263 182591, 2122263 183396, 2121666 183401))"}
https://data.okc.gov/services/portal/api/data/records/schools
{"SpatialFilter":"Point(2121666 183401)", "BufferDistance":"2000"}
https://data.okc.gov/services/portal/api/data/records/schools
{"OrderByField":"school_name", "Ascending":"false"}
https://data.okc.gov/services/portal/api/data/records/schools
{"FilterField":"school_name", "FilterType":"like", "FilterValue": ["WESTERN"]}
https://data.okc.gov/services/portal/api/data/records/schools
{"FilterField":"object_id", "FilterType":"in", "FilterValue": ["1", "2", "12"]}

Map API

Provides access to data optimized for displaying on maps in either XML or JSON format. Spatial information is returned in decimal degrees. This API supports HTTP Get method only.

Syntax:

https://data.okc.gov/services/portal/api/map/layers/[ID] ? [option1=value]
& [option2=value]
...
& [optionN=value]

Option

Method

Values

Default

Required

Notes

ID get string optional Name of map (dataset) to return records for.
minLatitude get float 33 optional Minimum latitude of result extent.
maxLatitude get float 33 optional Maximum latitude of result extent.
minLongitude get float 33 optional Minimum longitude of result extent.
maxLongitude get float 33 optional Minimum longitude of result extent.
filterField get string optional Name of field to apply an attribute filter.
fitlerType get equal
notequal
like
notlike
in
notin
equal optional Use in conjunction with FilterField to specify the type of attribute comparison to use.
filterValue get string optional Use in conjunction with FilterField and FilterType to specify a value or array of values (in or notin) for an attribute filter.

Examples (HTTP GET)


https://data.okc.gov/services/portal/api/map/layers/City%20Council%20Wards
https://data.okc.gov/services/portal/api/map/layers/Schools?minLatitude=35.33539250737309&maxLatitude=35.34711150451013&minLongitude=-97.4963777405875&maxLongitude=-97.48195001057216
https://data.okc.gov/services/portal/api/map/layers/Schools?filterField=object_id&filterType=equal&filterValue=127