This API provides data for a word cloud on Politik. It accepts POST requests from Politik Lobbyist API. The Politik Lobbyist API sends strings of text from Lobbyist filings and the Common Words API keeps track of how many times each word appears.
POST /api/v1/common_words
Expects a payload in this format:
{ "representation_id": <integer>, "issue_string": <string> }If successful, it will return
status code: 201
response body:
{ "message": "Lobbying Representation: <lobbying_represenntation_id> issue logged in common words system." }
GET /api/v1/common_words
Returns all words from the database with the amount of times they occur in Lobbyist Representation Filings from the other API
{
"text": "activities",
"value": 12
},
{
"text": "good",
"value": 4
},
{
"text": "remote",
"value": 6
},
{
"text": "innovation",
"value": 22
},
{
"text": "advancing",
"value": 6
},
{
"text": "army",
"value": 13
},
{
"text": "clean",
"value": 23
},
{
"text": "water",
"value": 47
}
- Clone this repo
$ cd
into directory$ bundle update
$ rake db:{create,migrate}
$ rspec
to run the test suite$ rails s
use PostMan or similar to make a POST request to localhost:3000/api/v1/common_words