This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
forked from samjaninf/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
3172 lines (2956 loc) · 157 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
HOST: https://api.civil.services/v1
# API
![Civil Services Logo](https://cdn.civil.services/common/github-logo.png "Civil Services Logo")
Civil Services is a collection of tools that make it possible for citizens to be a part of what is happening in their Local, State & Federal Governments.
* _Maintained By:_ __[Peter Schmalfeldt](https://twitter.com/mrmidi)__
* _Last Modified:_ __April 29th, 2017__
* _Current API Version:_ __v1.1.0__
__IMPORTANT:__ Currently, our API is only open for select non-commercial use. You can __[Register for an API Key](https://api.civil.services)__ if you would like access to our API. We typically review applications within a business day.
[![API Documentation](https://raw.githubusercontent.com/CivilServiceUSA/api/master/docs/img/apiary.jpg)](http://docs.civilservices.apiary.io)
## Join us on Slack
__[Join us on Slack](https://slack.civil.services/bkx7n2)__ if you need help using our API, or you are interested in contributing.
[![Slack Team Invite](https://cdn.civil.services/common/slack-invite.png)](https://slack.civil.services/bkx7n2)
# Group API Basics
## API Overview
Our API has a default Rate Limit by IP Address to `2500` calls per day. We add the following headers so you can monitor your API Rate:
* __X-Rate-Limit-Limit__: The rate limit ceiling for that given request
* __X-Rate-Limit-Remaining__: The number of requests left for the 24 hour window
* __X-Rate-Limit-Reset__: The remaining window before the rate limit resets in UTC [epoch seconds](http://en.wikipedia.org/wiki/Unix_time)
If a specific IP Address exceeds this limit, the API will return a 429 HTTP JSON Response Error. A sample of this is provided in the Artwork API endpoint.
## API Authentication
Our API requires an API Key to use. We are not providing API Keys to the general public at this time. You likely received an API Key before accessing this documentation, if not, please contact the individual who sent you here.
## You can set the API Key one of two ways
#### Request Header:
* __API-Key__ `243CEA2E-7E63-D2C4-3D2D-1A114288274B` _( this is not an actual API Key )_
#### GET Parameter:
* __?apikey=__ `243CEA2E-7E63-D2C4-3D2D-1A114288274B`
### HTTP Request Method Limits
### Common API Responses
The following parameters are available on every API endpoint and used for pagination
for if there are a lot of results.
+ `notices` (array, optional) - An array of API Notices. These notices are for the API to let the Developer know something that might be helpful, but will not impact the API results.
+ `warnings` (array, optional) - An array of API Warnings. These warnings explain why the API might have had issues returning results.
+ `errors` (array, optional) - An array of API Errors. These errors explain why the API prevented returning results.
+ `field_errors` (object, optional) - If the error was in regards to data entry, any errors specific to an input field will return here with the input name and error message.
+ `meta` (object) - The META data object that contains the basic information about the API response.
+ `meta.total` (number) - Total number of all results. Not just the number returned in the API call.
+ `meta.showing` (number) - Number of results returned in the current API call ( may be less than total results ).
+ `meta.pages` (number) - Number of pages of results. This is based on the `total` results divided by the `pageSize`.
+ `meta.page` (number) - Current Page
+ `data` (object or array) - This is the the actual data returned for the API call. For API calls that are expected to return a single result, the `data` will be an Object. For API calls that are expecting multiple items returned, `data` will be returned as an array ( even if there is only one item returned, such as search results, etc ).
+ `data.civil_services_url` (string) - This will exist for results that have custom pages on the https://civil.services website.
__Response 200:__ (application/json)
```
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 97,
"showing": 30,
"pages": 4,
"page": 1
},
"data": [
...
]
}
```
__Response 403:__ (application/json)
```
{
"notices": [],
"warnings": [],
"errors": ["Missing API Key"],
"field_errors": {},
"meta": {
"total": 0,
"showing": 0,
"pages": 1,
"page": 1
},
"data": []
}
```
### Optional API Params
The following parameters are available on most API endpoint and used for pagination
for if there are a lot of results.
+ `apikey` (string) - Your Civil Services API Key
+ `fields` (string) - Comma Separated List of fields you want in the response. By default all public fields will be returned, but if you only need specific fields you can greatly simplify your API response by specifying them.
+ `pageSize` (number, optional) - How many results to return in a single API call. Defaults to 30
+ `page` (number, optional) - If there is more than one page of results, you can set which page to load here
+ `sort` (optional, string, `population_rank`) - Comma Separated List of fields you want to sort by
+ `order` (optional, string, `asc`) - Comma Separated List of Order Methods
+ `pretty` (optional) - If you want to format the JSON response to be human readable, just add a `pretty` param in the API call ( it does not need a value )
# Group City Council Endpoints
The following endpoints are for specific data related to City Council members. Currently we only have City Council Data for New York, NY.
## City Council [/city-council/{?apikey,page,pageSize,fields,sort,order,zipcode,latitude,longitude,state,district,atLarge,vacant,title,party,name,gender,ethnicity,age,minAge,maxAge,termEnds,termEndsBefore,termEndsAfter,enteredOffice,enteredOfficeBefore,enteredOfficeAfter}]
Search for City Council members using any combination of search parameters.
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `name,party,photo_url`) - Comma Separated List of fields you want in the response
+ sort (optional, string, `state_code,name`) - Comma Separated List of fields you want to sort by
+ order (optional, string, `asc,asc`) - Comma Separated List of Order Methods
+ zipcode (optional, string, `97232`) - United Steps Zip Code
+ latitude (optional, float, `45.542094`) - GPS Latitude ( `longitude` required if used )
+ longitude (optional, float, `-122.9346037`) - GPS Longitude ( `latitude` required if used )
+ state (optional, string, `OR`) - State ( Full State Name or Two Letter Abbreviation )
+ district (optional, number, `3`) - District of Representative ( not always available )
+ atLarge (optional, boolean, `true`) - Representative is considered At-Large
+ vacant (optional, boolean, `true`) - Representative Seat is Vacant
+ title (optional, enum, `district-attorney`)
Title of Senator. Using a comma to filter with multiple options, e.g. `?title=district-attorney,mayor`
+ Values
+ `alderman`
+ `chairman`
+ `city-attorney`
+ `city-auditor`
+ `city-controller`
+ `commissioner`
+ `council-president`
+ `councilor`
+ `deputy-leader`
+ `deputy-mayor-pro-tem`
+ `deputy-majority-leader`
+ `deputy-majority-whip`
+ `deputy-minority-leader`
+ `deputy-minority-whip`
+ `district-attorney`
+ `majority-leader`
+ `majority-whip`
+ `mayor`
+ `mayor-pro-tem`
+ `minority-leader`
+ `minority-whip`
+ `representative`
+ `supervisor`
+ `president`
+ `president-pro-tem`
+ `vice-chairman`
+ `vice-mayor`
+ `vice-president`
+ `vacant`
+ party (optional, enum, `democrat`) -
Political Party of Senator. Using a comma to filter with multiple options, e.g. `?party=democrat,republican`
+ Values
+ `constitution`
+ `democrat`
+ `green`
+ `independent`
+ `libertarian`
+ `nonpartisan`
+ `republican`
+ name (optional, string, `Bill De Blasio`) - Full Name of Senator
+ gender (optional, enum, `female`)
Gender of Senator. Using a comma to filter with multiple options, e.g. `?gender=female,male`
+ Values
+ `female`
+ `male`
+ `unspecified`
+ ethnicity (optional, enum, `african-american`)
Ethnicity of Senator. Using a comma to filter with multiple options, e.g. `?ethnicity=african-american,asian-american`
+ Values
+ `african-american`
+ `asian-american`
+ `hispanic-american`
+ `middle-eastern-american`
+ `multi-racial-american`
+ `native-american`
+ `pacific-islander`
+ `white-american`
+ `unspecified`
+ age (optional, number, `65`) - Age of Senator
+ minAge (optional, number, `40`) - Minimum Age of Senator
+ maxAge (optional, number, `80`) - Maximum Age of Senator
+ termEnds (optional, number, `2019`) - Year Term Ends ( formatted `YYYY` )
+ termEndsBefore (optional, number, `2023`) - Term Ends Before this Year ( formatted `YYYY` )
+ termEndsAfter (optional, number, `2016`) - Term Ends After this Year ( formatted `YYYY` )
+ enteredOffice (optional, number, `2017`) - Year Entered Office ( formatted `YYYY` )
+ enteredOfficeBefore (optional, number, `2008`) - Entered Office Before this Year ( formatted `YYYY` )
+ enteredOfficeAfter (optional, number, `2017`) - Entered Office After this Year ( formatted `YYYY` )
### Example: Mayor New York [GET]
This example fetches details for the state `NY` and title `mayor`.
+ Request
+ Parameters
+ state: NY
+ title: mayor
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ state: NY
+ title: mayor
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 1,
"showing": 1,
"pages": 1,
"page": 1
},
"data": [
{
"address_city": "New York",
"address_complete": "250 Broadway Suite 1823 New York, NY 10007",
"address_number": "250",
"address_prefix": null,
"address_sec_unit_num": "1823",
"address_sec_unit_type": "Suite",
"address_state": "NY",
"address_street": "Broadway",
"address_type": null,
"address_zipcode": "10007",
"age": 55,
"aliases": [
"Democrat Bill De Blasio",
"Democrat De Blasio",
"Mayor Bill De Blasio",
"Mayor De Blasio",
"Bill De Blasio [D]",
"Bill De Blasio (D)"
],
"at_large": false,
"background_url": "https://cdn.civil.services/city-council/ny/new-york/backgrounds/1280x720/city.jpg",
"city_council_calendar_url": null,
"city_council_committees_url": "http://legistar.council.nyc.gov/Departments.aspx",
"city_council_legislation_url": "http://legistar.council.nyc.gov/Legislation.aspx",
"city_council_url": "http://council.nyc.gov/districts/",
"city_government_url": "http://www.nycgo.com",
"city_name": "New York",
"city_name_slug": "new-york",
"civil_services_url": "https://civil.services/city-council/new-york/new-york/councilor/bill-de-blasio",
"date_of_birth": "1961-05-08",
"district": null,
"email": null,
"entered_office": "2014-01-01",
"ethnicity": "white-american",
"facebook_url": "https://www.facebook.com/bill.deblasio/",
"first_name": "Bill",
"gender": "male",
"goes_by": null,
"last_name": "De Blasio",
"latitude": 40.6643,
"longitude": -73.9385,
"middle_name": "Bill",
"name": "Bill De Blasio",
"name_slug": "bill-de-blasio",
"name_suffix": null,
"party": "democrat",
"phone": "212-788-3000",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/bill-de-blasio.jpg",
"photo_url_sizes": {
"size_64x64": "https://cdn.civil.services/city-council/ny/new-york/headshots/64x64/bill-de-blasio.jpg",
"size_128x128": "https://cdn.civil.services/city-council/ny/new-york/headshots/128x128/bill-de-blasio.jpg",
"size_256x256": "https://cdn.civil.services/city-council/ny/new-york/headshots/256x256/bill-de-blasio.jpg",
"size_512x512": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/bill-de-blasio.jpg",
"size_1024x1024": "https://cdn.civil.services/city-council/ny/new-york/headshots/1024x1024/bill-de-blasio.jpg"
},
"population": 8550405,
"pronunciation": null,
"state_code": "NY",
"state_code_slug": "ny",
"state_name": "New York",
"state_name_slug": "new-york",
"term_end": "2017-12-31",
"title": "mayor",
"twitter_handle": "BilldeBlasio",
"twitter_url": "https://twitter.com/BilldeBlasio",
"vacant": false
}
],
"attribution": {
"text": "Data Provided by Civil Services",
"website": "https://civil.services",
"link": "<a href=\"https://civil.services\">Data Provided by Civil Services</a>",
"license": "https://raw.githubusercontent.com/CivilServiceUSA/api/master/LICENSE",
"report_bug": "https://github.com/CivilServiceUSA/api/issues/new",
"logo": "https://cdn.civil.services/common/logo.png",
"icon": "https://cdn.civil.services/common/icon.png"
}
}
## City Council [/city-council/{state}/{city}{?apikey,page,pageSize,fields,sort,order}]
Search for City Council members using any combination of search parameters.
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `name,party,photo_url`) - Comma Separated List of fields you want in the response
+ sort (optional, string, `state_code,name`) - Comma Separated List of fields you want to sort by
+ order (optional, string, `asc,asc`) - Comma Separated List of Order Methods
+ state (required, string, `NY`) - Unique Zip Code
+ city (required, string, `New York`) - Unique Zip Code
### Example: New York City Council [GET]
This example fetches details for the state `NY` and city `New York` with only the `name,title,photo_url` fields.
+ Request
+ Parameters
+ state: `NY`
+ city: `New York`
+ fields: `name,title,photo_url`
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ state: `NY`
+ city: `New York`
+ fields: `name,title,photo_url`
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 53,
"showing": 30,
"pages": 2,
"page": 1
},
"data": [
{
"name": "Daniel Garodnick",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/daniel-garodnick.jpg",
"title": "councilor"
},
{
"name": "Inez Dickens",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/inez-dickens.jpg",
"title": "councilor"
},
{
"name": "Andrew Cohen",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/andrew-cohen.jpg",
"title": "councilor"
},
{
"name": "Vanessa Gibson",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/vanessa-gibson.jpg",
"title": "councilor"
},
{
"name": "Barry Grodenchik",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/barry-grodenchik.jpg",
"title": "councilor"
},
{
"name": "Ruben Wills",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/ruben-wills.jpg",
"title": "councilor"
},
{
"name": "Elizabeth Crowley",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/elizabeth-crowley.jpg",
"title": "councilor"
},
{
"name": "Laurie Cumbo",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/laurie-cumbo.jpg",
"title": "councilor"
},
{
"name": "Inez Barron",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/inez-barron.jpg",
"title": "councilor"
},
{
"name": "Mark Treyger",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/mark-treyger.jpg",
"title": "councilor"
},
{
"name": "Ben Kallos",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/ben-kallos.jpg",
"title": "councilor"
},
{
"name": "Andy King",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/andy-king.jpg",
"title": "councilor"
},
{
"name": "Rafael Salamanca",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/rafael-salamanca.jpg",
"title": "councilor"
},
{
"name": "Rory Lancman",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/rory-lancman.jpg",
"title": "councilor"
},
{
"name": "Karen Koslowitz",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/karen-koslowitz.jpg",
"title": "councilor"
},
{
"name": "Donovan Richards",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/donovan-richards.jpg",
"title": "councilor"
},
{
"name": "Robert Cornegy",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/robert-cornegy.jpg",
"title": "councilor"
},
{
"name": "Vincent Gentile",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/vincent-gentile.jpg",
"title": "councilor"
},
{
"name": "Chaim Deutsch",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/chaim-deutsch.jpg",
"title": "councilor"
},
{
"name": "Steven Matteo",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/steven-matteo.jpg",
"title": "minority-leader"
},
{
"name": "Margaret Chin",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/margaret-chin.jpg",
"title": "councilor"
},
{
"name": "Helen Rosenthal",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/helen-rosenthal.jpg",
"title": "councilor"
},
{
"name": "James Vacca",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/james-vacca.jpg",
"title": "councilor"
},
{
"name": "Annabel Palma",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/annabel-palma.jpg",
"title": "councilor"
},
{
"name": "Peter Koo",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/peter-koo.jpg",
"title": "councilor"
},
{
"name": "Daniel Dromm",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/daniel-dromm.jpg",
"title": "councilor"
},
{
"name": "Eric Ulrich",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/eric-ulrich.jpg",
"title": "councilor"
},
{
"name": "Rafael Espinal",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/rafael-espinal.jpg",
"title": "councilor"
},
{
"name": "David Greenfield",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/david-greenfield.jpg",
"title": "councilor"
},
{
"name": "Deborah Rose",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/deborah-rose.jpg",
"title": "deputy-majority-leader"
}
],
"attribution": {
"text": "Data Provided by Civil Services",
"website": "https://civil.services",
"link": "<a href=\"https://civil.services\">Data Provided by Civil Services</a>",
"license": "https://raw.githubusercontent.com/CivilServiceUSA/api/master/LICENSE",
"report_bug": "https://github.com/CivilServiceUSA/api/issues/new",
"logo": "https://cdn.civil.services/common/logo.png",
"icon": "https://cdn.civil.services/common/icon.png"
}
}
# Group Geolocation Endpoints
The following endpoints are for specific data related to Zip Codes and Geolocation data.
## Zip Code [/geolocation/zipcode/{zipcode}{?apikey,page,pageSize,fields,sort,order}]
Fetch details for a Specific Zip Code
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `city,state,location`) - Comma Separated List of fields you want in the response
+ sort (optional, string, `city_number`) - Comma Separated List of fields you want to sort by
+ order (optional, string, `asc`) - Comma Separated List of Order Methods
+ zipcode (required, string, `97232`) - Unique Zip Code
### Example: Location Info for 97232 [GET]
This example fetches details for the zip code `97232`.
+ Request
+ Parameters
+ zipcode: 97232
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ zipcode: 97232
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 1,
"showing": 1,
"pages": 1,
"page": 1
},
"data": [
{
"alternate_city_names": [],
"area_codes": [
"971",
"503"
],
"city": "Portland",
"county": "Multnomah County",
"estimated_population": 10780,
"location": {
"lat": 45.5295528,
"lon": -122.6463158
},
"state": "OR",
"timezone": "America/Los_Angeles",
"zipcode": "97232"
}
],
"attribution": {
"text": "Data Provided by Civil Services",
"website": "https://civil.services",
"link": "<a href=\"https://civil.services\">Data Provided by Civil Services</a>",
"license": "https://raw.githubusercontent.com/CivilServiceUSA/api/master/LICENSE",
"report_bug": "https://github.com/CivilServiceUSA/api/issues/new",
"logo": "https://cdn.civil.services/common/logo.png",
"icon": "https://cdn.civil.services/common/icon.png"
}
}
## IP Address [/geolocation/ip/{ipaddress}{?apikey,page,pageSize,fields,sort,order}]
Fetch details for a Specific IP Address
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `city,location`) - Comma Separated List of fields you want in the response
+ sort (optional, string, `city_continent`) - Comma Separated List of fields you want to sort by
+ order (optional, string, `asc`) - Comma Separated List of Order Methods
+ ipaddress (required, string, `97.96.74.114`) - IP Address to Lookup ( Defaults to Requester's IP Address )
### Example: Location Info for 97.96.74.114 [GET]
This example fetches details for the ip address `97.96.74.114`.
+ Request
+ Parameters
+ ipaddress: 97.96.74.114
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ ipaddress: 97.96.74.114
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 1,
"showing": 1,
"pages": 1,
"page": 1
},
"data": {
"city": {
"geoname_id": 4171563,
"names": {
"en": "St. Petersburg"
}
},
"continent": {
"code": "NA",
"geoname_id": 6255149,
"names": {
"de": "Nordamerika",
"en": "North America",
"es": "Norteamérica",
"fr": "Amérique du Nord",
"ja": "北アメリカ",
"pt-BR": "América do Norte",
"ru": "Северная Америка",
"zh-CN": "北美洲"
}
},
"country": {
"geoname_id": 6252001,
"iso_code": "US",
"names": {
"de": "USA",
"en": "United States",
"es": "Estados Unidos",
"fr": "États-Unis",
"ja": "アメリカ合衆国",
"pt-BR": "Estados Unidos",
"ru": "США",
"zh-CN": "美国"
}
},
"location": {
"accuracy_radius": 1,
"latitude": 27.7723,
"longitude": -82.6341,
"metro_code": 539,
"time_zone": "America/New_York"
},
"postal": {
"code": "33701"
},
"registered_country": {
"geoname_id": 6252001,
"iso_code": "US",
"names": {
"de": "USA",
"en": "United States",
"es": "Estados Unidos",
"fr": "États-Unis",
"ja": "アメリカ合衆国",
"pt-BR": "Estados Unidos",
"ru": "США",
"zh-CN": "美国"
}
},
"subdivisions": [
{
"geoname_id": 4155751,
"iso_code": "FL",
"names": {
"en": "Florida",
"es": "Florida",
"fr": "Floride",
"ja": "フロリダ州",
"pt-BR": "Flórida",
"ru": "Флорида",
"zh-CN": "佛罗里达州"
}
}
]
},
"attribution": {
"text": "Data Provided by Civil Services",
"website": "https://civil.services",
"link": "<a href=\"https://civil.services\">Data Provided by Civil Services</a>",
"license": "https://raw.githubusercontent.com/CivilServiceUSA/api/master/LICENSE",
"report_bug": "https://github.com/CivilServiceUSA/api/issues/new",
"logo": "https://cdn.civil.services/common/logo.png",
"icon": "https://cdn.civil.services/common/icon.png"
}
}
## Geolocation [/geolocation/{?apikey,page,pageSize,fields,sort,order,zipcode,city,county,state,areaCode,timezone,minPopulation,maxPopulation,latitude,longitude,distance}]
Get Location Specific Data using any combination of filters.
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `city,location`) - Comma Separated List of fields you want in the response
+ sort (optional, string, `city`) - Comma Separated List of fields you want to sort by
+ order (optional, string, `asc`) - Comma Separated List of Order Methods
+ zipcode (optional, string, `97232`) - Unique Zip Code
+ city (optional, string, `Portland`) - City to use as Filter
+ county (optional, string, `Multnomah`) - County to use as Filter
+ state (optional, string, `OR`) - State to use as Filter
+ areaCode (optional, number, `573`) - Area Code of Phone Number to use as Filter
+ timezone (optional, string, `America/New_York`) - Time Zone of Location
+ minPopulation (optional, number, `10000`) - Minimum Population of Location
+ maxPopulation (optional, number, `1000000`) - Maximum Population of Location
+ latitude (optional, number, `45.542094`) - Latitude to base Location on
+ longitude (optional, number, `-122.9346037`) - Longitude to base Location on
+ distance (optional, string, `25mi`) - Distance from Latitude & Longitude
### Example: Location Info for Saint Louis, MO [GET]
This example fetches details for the city of __Saint Louis, MO__ using the `state` and `city` parameters.
+ Request
+ Parameters
+ state: MO
+ city: Saint Louis
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ state: MO
+ city: Saint Louis
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 3,
"showing": 3,
"pages": 1,
"page": 1
},
"data": [
{
"alternate_city_names": [
"Saint Peters",
"St Peters"
],
"area_codes": [
"314",
"636"
],
"city": "Saint Charles",
"county": "St Charles County",
"estimated_population": 43920,
"location": {
"lat": 38.7250374,
"lon": -90.554149
},
"state": "MO",
"timezone": "America/Chicago",
"zipcode": "63303"
},
{
"alternate_city_names": [
"Cottleville",
"Saint Peters",
"St Peters",
"Weldon Spring"
],
"area_codes": [
"314",
"636"
],
"city": "Saint Charles",
"county": "St Charles County",
"estimated_population": 40840,
"location": {
"lat": 38.7036005,
"lon": -90.6488505
},
"state": "MO",
"timezone": "America/Chicago",
"zipcode": "63304"
},
{
"alternate_city_names": [
"Lake St Louis",
"O Fallon"
],
"area_codes": [
"636"
],
"city": "Lake Saint Louis",
"county": "St Charles County",
"estimated_population": 22230,
"location": {
"lat": 38.786556,
"lon": -90.7818089
},
"state": "MO",
"timezone": "America/Chicago",
"zipcode": "63367"
}
],
"attribution": {
"text": "Data Provided by Civil Services",
"website": "https://civil.services",
"link": "<a href=\"https://civil.services\">Data Provided by Civil Services</a>",
"license": "https://raw.githubusercontent.com/CivilServiceUSA/api/master/LICENSE",
"report_bug": "https://github.com/CivilServiceUSA/api/issues/new",
"logo": "https://cdn.civil.services/common/logo.png",
"icon": "https://cdn.civil.services/common/icon.png"
}
}
# Group Government Endpoints
This returns data for both the `/governor`, `/house`, `/senate` & `/state` endpoints with one call.
## Government [/government/{?apikey,page,pageSize,fields,zipcode,latitude,longitude,state}]
Search for House Representative using any combination of search parameters. You can also add any of the search parameters from either of the `/senate` & `/house` endpoints.
+ Parameters
+ apikey (string, optional, `YOUR-API-KEY`) - Your API Key
+ page (number, optional, `1`) - Which page to load here
+ pageSize (number, optional, `50`) - Maximum Number of Results to Show
+ fields (optional, string, `house,senate`) - Comma Separated List of fields you want in the response
+ zipcode (optional, string, `97232`) - United Steps Zip Code
+ latitude (optional, float, `45.542094`) - GPS Latitude ( `longitude` required if used )
+ longitude (optional, float, `-122.9346037`) - GPS Longitude ( `latitude` required if used )
+ state (optional, string, `OR`) - State ( Full State Name or Two Letter Abbreviation )
### Example: House & Senate in Zip Code 97232 [GET]
+ Request
+ Parameters
+ latitude: `40.75368539999999`
+ longitude: `-73.9991637`
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ latitude: `40.75368539999999`
+ longitude: `-73.9991637`
+ Body
{
"notices": [],
"warnings": [],
"errors": [],
"field_errors": {},
"meta": {
"total": 1,
"showing": 1,
"pages": 1,
"page": 1
},
"data": {
"city_council": [
{
"address_city": "New York",
"address_complete": "250 Broadway Suite 1823 New York, NY 10007",
"address_number": "250",
"address_prefix": null,
"address_sec_unit_num": "1823",
"address_sec_unit_type": "Suite",
"address_state": "NY",
"address_street": "Broadway",
"address_type": null,
"address_zipcode": "10007",
"age": 55,
"aliases": [
"Democrat Bill De Blasio",
"Democrat De Blasio",
"Mayor Bill De Blasio",
"Mayor De Blasio",
"Bill De Blasio [D]",
"Bill De Blasio (D)"
],
"at_large": false,
"background_url": "https://cdn.civil.services/city-council/ny/new-york/backgrounds/1280x720/city.jpg",
"city_council_calendar_url": null,
"city_council_committees_url": "http://legistar.council.nyc.gov/Departments.aspx",
"city_council_legislation_url": "http://legistar.council.nyc.gov/Legislation.aspx",
"city_council_url": "http://council.nyc.gov/districts/",
"city_government_url": "http://www.nycgo.com",
"city_name": "New York",
"city_name_slug": "new-york",
"civil_services_url": "https://civil.services/city-council/new-york/new-york/councilor/bill-de-blasio",
"date_of_birth": "1961-05-08",
"district": null,
"email": null,
"entered_office": "2014-01-01",
"ethnicity": "white-american",
"facebook_url": "https://www.facebook.com/bill.deblasio/",
"first_name": "Bill",
"gender": "male",
"goes_by": null,
"last_name": "De Blasio",
"latitude": 40.6643,
"longitude": -73.9385,
"middle_name": "Bill",
"name": "Bill De Blasio",
"name_slug": "bill-de-blasio",
"name_suffix": null,
"party": "democrat",
"phone": "212-788-3000",
"photo_url": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/bill-de-blasio.jpg",
"photo_url_sizes": {
"size_64x64": "https://cdn.civil.services/city-council/ny/new-york/headshots/64x64/bill-de-blasio.jpg",
"size_128x128": "https://cdn.civil.services/city-council/ny/new-york/headshots/128x128/bill-de-blasio.jpg",
"size_256x256": "https://cdn.civil.services/city-council/ny/new-york/headshots/256x256/bill-de-blasio.jpg",
"size_512x512": "https://cdn.civil.services/city-council/ny/new-york/headshots/512x512/bill-de-blasio.jpg",
"size_1024x1024": "https://cdn.civil.services/city-council/ny/new-york/headshots/1024x1024/bill-de-blasio.jpg"
},
"population": 8550405,
"pronunciation": null,
"state_code": "NY",
"state_code_slug": "ny",
"state_name": "New York",
"state_name_slug": "new-york",
"term_end": "2017-12-31",
"title": "mayor",
"twitter_handle": "BilldeBlasio",
"twitter_url": "https://twitter.com/BilldeBlasio",
"vacant": false
},
{
"address_city": "New York",
"address_complete": "250 Broadway Suite 1823 New York, NY 10007",
"address_number": "250",
"address_prefix": null,
"address_sec_unit_num": "1823",
"address_sec_unit_type": "Suite",
"address_state": "NY",
"address_street": "Broadway",
"address_type": null,
"address_zipcode": "10007",
"age": 35,
"aliases": [
"Democrat Corey Johnson",
"Democrat Johnson",
"Councilor Corey Johnson",
"Councilor Johnson",
"Corey Johnson [D]",
"Corey Johnson (D)"
],
"at_large": false,
"background_url": "https://cdn.civil.services/city-council/ny/new-york/backgrounds/1280x720/city.jpg",
"city_council_calendar_url": null,
"city_council_committees_url": "http://legistar.council.nyc.gov/Departments.aspx",
"city_council_legislation_url": "http://legistar.council.nyc.gov/Legislation.aspx",
"city_council_url": "http://council.nyc.gov/districts/",
"city_government_url": "http://www.nycgo.com",
"city_name": "New York",
"city_name_slug": "new-york",