Calling REST API

Question: In q, you can issue HTTP requests via the functions .Q.hg (get) and .Q.hp (post). Write a statement that uses .Q.hg to get SAT Scores CSV data from https://data.cityofnewyork.us/api/views/f9bf-2cp4/rows.csv, and convert the CSV data into a table. Store the data in the variable 'data'. The column types are string, string, int, int, int. If you encounter a 'con error, export the following before starting q: $ export SSL_VERIFY_SERVER=NO

Example

                                
                                q)data
DBN      SCHOOL NAME                                                      Num of SAT Test Takers SAT Critical Reading Avg. Score SAT Math Avg. Score
----------------------------------------------------------------------------------------------------------------------------------------------------
"01M292" "HENRY STREET SCHOOL FOR INTERNATIONAL STUDIES"                  29                     355                             404
"01M448" "UNIVERSITY NEIGHBORHOOD HIGH SCHOOL"                            91                     383                             423
"01M450" "EAST SIDE COMMUNITY SCHOOL"                                     70                     377                             402
"01M458" "FORSYTH SATELLITE ACADEMY"                                      7                      414                             401
"01M509" "MARTA VALLE HIGH SCHOOL"                                        44                     390                             433
"01M515" "LOWER EAST SIDE PREPARATORY HIGH SCHOOL"                        112                    332                             557
"01M539" "NEW EXPLORATIONS INTO SCIENCE, TECHNOLOGY AND MATH HIGH SCHOOL" 159                    522                             574
"01M650" "CASCADES HIGH SCHOOL"                                           18                     417                             418
"01M696" "BARD HIGH SCHOOL EARLY COLLEGE"                                 130                    624                             604
"02M047" "47 THE AMERICAN SIGN LANGUAGE AND ENGLISH SECONDARY SCHOOL"     16                     395                             400
"02M288" "FOOD AND FINANCE HIGH SCHOOL"                                   62                     409                             393
"02M294" "ESSEX STREET ACADEMY"                                           53                     394                             384
"02M296" "HIGH SCHOOL OF HOSPITALITY MANAGEMENT"                          58                     374                             375
"02M298" "PACE HIGH SCHOOL"                                               85                     423                             438
"02M300" "URBAN ASSEMBLY SCHOOL OF DESIGN AND CONSTRUCTION, THE"          48                     404                             449
"02M303" "FACING HISTORY SCHOOL, THE"                                     76                     353                             358
"02M305" "URBAN ASSEMBLY ACADEMY OF GOVERNMENT AND LAW, THE"              50                     375                             388
"02M308" "LOWER MANHATTAN ARTS ACADEMY"                                   40                     403                             392
"02M313" "JAMES BALDWIN SCHOOL, THE: A SCHOOL FOR EXPEDITIONARY LEARNING" 69                     408                             390
"02M316" "URBAN ASSEMBLY SCHOOL OF BUSINESS FOR YOUNG WOMEN, THE"         42                     373                             370
..
                                
                            

Solution

Tags:
api csv
Searchable Tags
algorithms api csv dictionaries feedhandler finance functions ingestion ipc iterators math optimizations realtime sql streaming strings tables temporal websockets

Email sent!

Email not sent