okfn-brasil / querido-diario-api

This is Querido Diário's API. It provides everything the frontend does and even more!
https://queridodiario.ok.org.br/api/docs
MIT License
48 stars 32 forks source link

Censo API endpoints #22

Closed jvanz closed 3 years ago

jvanz commented 3 years ago

The https://github.com/okfn-brasil/censo-querido-diario has a database that should be available in the API. So, we need to make the database available to the API and create the endpoints.

Suggested implementation:

request:

response:

request

GET /cities?query=b[&size=3]

response

{
    "cities": [
        {
            "territory_id": "2502201",
            "territory_name": "Bom Jesus",
            "state_code": "PB",
            "access_level": "name",
            "source_publisher": ["multi", "value"]
        },
        {
            "territory_id": "4202404",
            "territory_name": "Blumenau",
            "state_code": "SC",
            "access_level": "name",
            "source_publisher": ["multi", "value"]
        },
        {
            "territory_id": "4302303",
            "territory_name": "Bom Jesus",
            "state_code": "RS",
            "access_level": "name",
            "source_publisher": ["multi", "value"]
        }
    ]
}
jvanz commented 3 years ago

To allow the development of this feature we need to load the data from a database. I just pushed in another branch a database interface. The branch has a fake database implementation which reads the data from a csv file. Thus, we can test the endpoints added for this issue.

andreformento commented 3 years ago

Very nice @jvanz 🤘

jvanz commented 3 years ago

I'm working to finish this.