Skip to contents

Review the Legistar Web API documentation for more information. This function is a work in progress. As of May 2024, it returns all results for any query calling itself recursively.

Usage

legistar(
  ...,
  template = "actions",
  client = getOption("legistarapi.client"),
  top = NULL,
  skip = NULL,
  select = NULL,
  filter = NULL,
  orderby = NULL,
  direction = NULL,
  count = NULL,
  inlinecount = NULL,
  .multi = "pipe",
  simplifyVector = TRUE,
  n_max = NULL,
  error_call = caller_env()
)

Arguments

...

Template variables.

template

A template string which consists of a optional HTTP method and a path containing variables labelled like either :foo or {foo}.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

top, skip, select, filter, orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count, inlinecount

Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ,, e.g. ?x=1,2.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

n_max

Maximum number of records to return. Currently unsupported.

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Examples

legistar(template = "persons", client = "seattle", top = 5)
#>   PersonId                           PersonGuid   PersonLastModifiedUtc
#> 1      120 AB1EC5B5-4AFA-4B70-ADDE-C0ECA2C97FEF 2014-05-27T22:02:36.467
#> 2      145 F07E7510-D2B5-4574-8F38-01552AD1B581 2014-05-27T22:02:36.467
#> 3      169 2D8E1621-3625-4BAC-BD75-762C720B3085 2014-05-27T22:02:36.467
#> 4      173 54718D76-B468-43BF-B935-7266D9261349 2014-05-27T22:02:36.467
#> 5      175 02FCAD3D-B104-412C-8566-99184F91BAFB 2014-05-27T22:02:36.467
#>   PersonRowVersion PersonFirstName PersonLastName  PersonFullName
#> 1     AAAAAAD1y1A=                        Daystar         Daystar
#> 2     AAAAAAArSwM=            View           Only       View Only
#> 3     AAAAAAArSwQ=        Legistar         System Legistar System
#> 4     AAAAAAEF4+U=             Ian          Smith       Ian Smith
#> 5     AAAAAAEORJc=          Emilia        Sanchez  Emilia Sanchez
#>   PersonActiveFlag PersonCanViewFlag PersonUsedSponsorFlag PersonAddress1
#> 1                0                 0                     0               
#> 2                1                 0                     0               
#> 3                1                 0                     0           <NA>
#> 4                1                 1                     0               
#> 5                1                 1                     0               
#>   PersonCity1 PersonState1 PersonZip1 PersonPhone PersonFax
#> 1                                                          
#> 2        <NA>         <NA>       <NA>                      
#> 3        <NA>         <NA>       <NA>        <NA>      <NA>
#> 4                                                          
#> 5                                                          
#>                  PersonEmail PersonWWW PersonAddress2 PersonCity2 PersonState2
#> 1      Legistar@granicus.com                                                  
#> 2                                                <NA>        <NA>         <NA>
#> 3                       <NA>      <NA>           <NA>        <NA>         <NA>
#> 4      Ian.Smith@seattle.gov                                                  
#> 5 Emilia.Sanchez@seattle.gov                                                  
#>   PersonZip2 PersonPhone2 PersonFax2 PersonEmail2 PersonWWW2
#> 1                                                           
#> 2       <NA>         <NA>       <NA>         <NA>       <NA>
#> 3       <NA>         <NA>       <NA>         <NA>       <NA>
#> 4                                                           
#> 5                                                           

legistar(template = "bodies", client = "baltimore", top = 5)
#>   BodyId                             BodyGuid     BodyLastModifiedUtc
#> 1      1 1AAB9B62-7520-4F91-9C1B-346195CB1EDA 2015-02-11T21:05:37.437
#> 2      3 7CFA25BF-46E8-4185-87B3-B09A24253E44 2015-02-11T21:05:37.437
#> 3      4 82BFC93F-543A-4295-8491-5A41CADFF774 2015-02-11T21:05:37.437
#> 4      5 C5D6523E-4BDF-49DE-AD18-5A7EF2F68363 2015-02-11T21:05:37.437
#> 5      6 50F79F8B-A6B9-4773-9358-E1C5A2414745 2015-02-11T21:05:37.437
#>   BodyRowVersion               BodyName BodyTypeId     BodyTypeName
#> 1   AAAAAABNnJA=           City Council          1 Legislative Body
#> 2   AAAAAABNnCM= Baltimore City Council          1 Legislative Body
#> 3   AAAAAAAAG1I=      Mayor(DO NOT USE)          2        Executive
#> 4   AAAAAAAAG1M=                  Mayor          2        Executive
#> 5   AAAAAAAAG1Q=     The Administration          2        Executive
#>   BodyMeetFlag BodyActiveFlag BodySort BodyDescription BodyContactNameId
#> 1            1              1        1                                NA
#> 2            1              1        1                                NA
#> 3            0              1        2            <NA>                NA
#> 4            0              1        2            <NA>                NA
#> 5            0              1        2            <NA>                NA
#>   BodyContactFullName BodyContactPhone BodyContactEmail BodyUsedControlFlag
#> 1                  NA               NA               NA                   0
#> 2                  NA               NA               NA                   0
#> 3                  NA               NA               NA                   0
#> 4                  NA               NA               NA                   0
#> 5                  NA               NA               NA                   0
#>   BodyNumberOfMembers BodyUsedActingFlag BodyUsedTargetFlag BodyUsedSponsorFlag
#> 1                   0                  0                  0                   0
#> 2                   0                  0                  0                   0
#> 3                   0                  0                  0                   0
#> 4                   0                  0                  0                   0
#> 5                   0                  0                  0                   0