Queries using SODA | Socrata [PDF]

The Socrata APIs provide rich query functionality through a query language we call the “Socrata Query Language” or â

3 downloads 33 Views 44KB Size

Recommend Stories


Reporting Queries PDF
Be like the sun for grace and mercy. Be like the night to cover others' faults. Be like running water

Discover Soda PDF 9 Enterprise
When you talk, you are only repeating what you already know. But if you listen, you may learn something

On Using Extended Statistical Queries to Avoid Membership Queries
Courage doesn't always roar. Sometimes courage is the quiet voice at the end of the day saying, "I will

mobile image search using multi-image queries
The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together.

K-Regret Queries Using Multiplicative Utility Functions
We can't help everyone, but everyone can help someone. Ronald Reagan

Caustic Soda
Every block of stone has a statue inside it and it is the task of the sculptor to discover it. Mich

bezpečnostní list krystalická soda krystalická soda
Seek knowledge from cradle to the grave. Prophet Muhammad (Peace be upon him)

Answering Queries Using Views with Arithmetic Comparisons
We can't help everyone, but everyone can help someone. Ronald Reagan

SODA ASH
Love only grows by sharing. You can only have more for yourself by giving it away to others. Brian

Diet Soda
The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together.

Idea Transcript


Queries using SODA Overview

The Socrata APIs provide rich query functionality through a query language we call the “Socrata Query Language” or “SoQL”. As its name might suggest, it borrows heavily from Structured Query Language (SQL)

API Endpoints

(http://en.wikipedia.org/wiki/Sql), used by many relational database systems. Its paradigms should be familiar to

(/docs/endpoints.html)

most developers who have previously worked with SQL, and are easy to learn for those who are new to it.

Row Identifiers (/docs/rowidentifiers.html) RESTful Verbs (/docs/verbs.html) Application Tokens (/docs/app-tokens.html) Authentication (/docs/authentication.html) Response Codes & Headers (/docs/response-codes.html) System Fields (/docs/system-fields.html) CORS & JSONP (/docs/cors-and-jsonp.html)

Filtering & Querying Simple Filters (/docs/filtering.html) SoQL Queries (/docs/queries/) Paging Through Data (/docs/paging.html) SoQL Function Listing (/docs/functions/)

Data Formats (/docs/formats/) JSON (/docs/formats/json.html) GeoJSON

SoQL Clauses SoQL statements are broken into “parameters” similar to clauses in SQL statements. Each clause can be expressed either directly as a URL parameter or as a SoQL statement. If a parameter is not specified, then the default is used. Click each parameter name for more details: Parameter

Description

Default

$select The set of columns to be returned, All columns, equivalent to $select=* (/docs/queries/select.html) similar to a SELECT in SQL $where Filters the rows to be returned, No filter (/docs/queries/where.html) similar to WHERE $order Column to order results on, similar to Unspecified order (/docs/queries/order.html) ORDER BY in SQL $group Column to group results on, similar to No grouping (/docs/queries/group.html) GROUP BY in SQL $having Filters the rows that result from an No filter (/docs/queries/having.html)aggregation, similar to HAVING $limit 1000 (2.0 endpoints: maximum of 50,000; Maximum number of results to return 2.1: unlimited » (/docs/endpoints.html)) (/docs/queries/limit.html) $offset Offset count into the results to start 0 (/docs/queries/offset.html) at, used for paging Performs a full text search for a $q (/docs/queries/q.html) No search value. $query A full SoQL query string, all as one N/A (/docs/queries/query.html) parameter $$bom Prepends a UTF-8 Byte Order Mark false (/docs/queries/bom.html) to the beginning of CSV output

In $query SELECT WHERE ORDER BY GROUP BY HAVING LIMIT OFFSET N/A N/A N/A

Note that for equality comparisons, the $where clause can be replaced with using the column name as the query parameter. See filtering (/docs/filtering.html) for more details. These parameters can then be directly added to the API endpoint. For example, here is how you would query the USGS Earthquakes datasets for quakes of greater than 3.0 on the Richter scale:

(/docs/formats/geojson.html)

https://soda.demo.socrata.com/resource/4tka-6guv.json?$where=magnitude > 3.0

CSV

(https://soda.demo.socrata.com/resource/4tka-6guv.json?$where=magnitude%20%3E%203.0)

(/docs/formats/csv.html)

In examples, we will leave the parameters as is, but it is best to URL Encode

RDF-XML (/docs/formats/rdf-

(http://en.wikipedia.org/wiki/Url_encode) your parameters to ensure they are parsed correctly.

xml.html)

Datatypes (/docs/datatypes/) Checkbox (/docs/datatypes/checkbox.html) Double (/docs/datatypes/double.html) Floating Timestamp (/docs/datatypes/floating_timestamp.html)

Line (/docs/datatypes/line.html) Location (/docs/datatypes/location.html) Money (/docs/datatypes/money.html) MultiLine (/docs/datatypes/multiline.html) MultiPoint (/docs/datatypes/multipoint.html) MultiPolygon (/docs/datatypes/multipolygon.html) Number (/docs/datatypes/number.html) Point (/docs/datatypes/point.html) Polygon (/docs/datatypes/polygon.html) Text (/docs/datatypes/text.html)

Other APIs Discovery (http://docs.socratadiscovery.apiary.io/) Open Performance (http://docs.openperformance.apiary.io/) OData (/odata/)

(http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US) Licensed by Socrata (http://socrata.com) under CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US). Learn how you can contribute! (/contributing.html)

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.