These examples will help you get started with the Legistar Web API. To use the URLs below, replace {Client} with your client name. Some clients require use of an API Token.
To see all agenda matters, the endpoint is:
https://webapi.legistar.com/v1/{Client}/matters
Note that queries replies are limited to 1000 responses. Even with this limit, some calls may return a large amount of data. To make this query more performant by limiting reults to a smaller set of items or to obtain more items via a second query, use ODATA parameters to page the output like this:
https://webapi.legistar.com/v1/{Client}/matters?$top=10&$skip=0 https://webapi.legistar.com/v1/{Client}/matters?$top=10&$skip=10
ODATA can also use filters to find more specific data. For instance, this query will return only events during the month of September, 2014:
https://webapi.legistar.com/v1/{Client}/events?$filter=EventDate+ge+datetime%272014-09-01%27+and+EventDate+lt+datetime%272014-10-01%27
The basics of the ODATA URL setup are here: https://www.odata.org/documentation/odata-version-3-0/url-conventions/
The ODATA documentation does not cover all features, including the convenience method datetime’2014-09-01’ shown above.
To see actions taken on a Matter (like a vote), look at the Matter Histories endpoint. Filtering these items by MatterHistoryActionBodyName can help to limit the found actions to just those votes performed by a certain group, for instance just to votes made by the Common Council on a matter 1234:
https://webapi.legistar.com/v1/{Client}/matters/1234/histories?$filter=MatterHistoryPassedFlag%20ne%20null%20and%20MatterHistoryActionBodyName%20eq%20%27Common%20Council%27
To then see the vote tally, use the returned Id (5678 in this example) with the EventItems Votes endpoint:
https://webapi.legistar.com/v1/{Client}/eventitems/5678/votes
There are many other items and relationships in the API. If you have a specific use case, we’d be happy to help you find the appropriate calls.
Some clients require use of API tokens for access. If the read-only operations above give an unauthorized response, please refer to that client for their token policy.
If you have a token, it can be provided as a URL parameter to the https endpoint of this API.
For example:
https://webapi.legistar.com/v1/{Client}/matters?token=verylongbase64token