Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saidziani/feedny-api
Flask API for Feedny mobile APP
https://github.com/saidziani/feedny-api
curl-commands flask-api flask-restful python
Last synced: 18 days ago
JSON representation
Flask API for Feedny mobile APP
- Host: GitHub
- URL: https://github.com/saidziani/feedny-api
- Owner: saidziani
- Created: 2018-04-13T18:34:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T23:25:37.000Z (over 6 years ago)
- Last Synced: 2024-10-28T10:24:58.670Z (2 months ago)
- Topics: curl-commands, flask-api, flask-restful, python
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Flask API
All API access is over HTTP[S], and accessed from http://localhost:5000/api/people/. All data is sent and received as JSON.
### Data structure (json)
* Example of data
```text
{
'id': 1,
'name': 'Foo',
'age': 25,
'sexe': 'H',
'student': False
}
```### Consuming API (curl)
* Get all rows: getPeople()
```text
$ curl -i http://localhost:5000/api/people/
```* Get one row using ID: getPerson(person_id)
```text
$ curl -i http://localhost:5000/api/people/id=person_id
```* Insert new row: createPerson()
```text
$ curl -i -H "Content-Type: application/json" -X POST -d '{"name":"Poo"}' http://localhost:5000/api/people/
```* Update existing row using ID: updatePerson(person_id)
```text
$ curl -i -H "Content-Type: application/json" -X PUT -d '{"student":true}' http://localhost:5000/api/people/id=2
```* Delete existing row using ID: deletePerson(person_id)
```text
$ curl -i -H "Content-Type: application/json" -X DELETE http://localhost:5000/api/people/id=2
```### Handle errors
* Not found error (404)
```text
HTTP/1.0 404 NOT FOUND
{
"error": "Not found"
}
```* Bad request error (400)
```text
HTTP/1.0 400 BAD REQUEST
{
"error": "Bad request"
}
```