Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shridarpatil/restapiz
Create rest api's dynamically within no time.
https://github.com/shridarpatil/restapiz
auto-generate-restapi dynamic-restapi flask restapi
Last synced: 24 days ago
JSON representation
Create rest api's dynamically within no time.
- Host: GitHub
- URL: https://github.com/shridarpatil/restapiz
- Owner: shridarpatil
- License: mit
- Created: 2017-03-02T13:30:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:28:21.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T04:23:02.670Z (26 days ago)
- Topics: auto-generate-restapi, dynamic-restapi, flask, restapi
- Language: Python
- Homepage:
- Size: 88.9 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
Flask-AutoGenerate-RestApi
-------
[![Build Status](https://img.shields.io/travis/shridarpatil/RestApiz.svg)](https://travis-ci.org/shridarpatil/RestApiz)
[![PyPi version](https://img.shields.io/pypi/v/RestApiz.svg)](https://pypi.python.org/pypi/RestApiz)
[![Updates](https://pyup.io/repos/github/shridarpatil/RestApiz/shield.svg)](https://pyup.io/repos/github/shridarpatil/RestApiz/)Create rest api's dynamically within no time.
* Free software: MIT license
Features
--------* Create Rest like apis without writing tons of lines of code.
# Flask-RestApi
RestApi module is used to create rest apis dynamically## Installation
```pip install RestApiz```### Prerequisites
Flask, MySQL## Getting Started
import RestApi
## Example
- Create rest api table
- Name: py_restapi
- Fields: id, method, query, url, before_query and after_query
- Create table po with fields poid and potext.POST:
--------
- For POST create entry in rest api table and call rest api as follows| rest_id | method | query | url | before_query | after_query |
| -------- | ------ | ------ | --- | ------------ | ----------- |
| 1 | POST | po | insert into po(poid, potext) values(%s, %s) | validatepost.validate_before:validation | validatepost.validate_after:validationUrl:/postPo
Method:POST
Content-Type:application/json
Body:{"poid":1, "potext":"po text"}
### Note:
```Inserts data into table 'po' ```GET:
---
- For GET create entry in rest api table and call rest api as follows| rest_id | method | query | url | before_query | after_query |
| -------- | ------ | ------ | --- | ------------ | ----------- |
| 1 | GET | select * from po where id=:id | getPo | | |Url:/getPo?id=1
Method:GET
Body:{"poid":1, "potext":"po text"}
PUT:
----
- For PUT create entry in rest api table and call rest api as follows| rest_id | method | query | url | before_query | after_query |
| -------- | ------ | ------ | --- | ------------ | ----------- |
| 1 | PUT | update po set potext=:potext where poid=;poid | putPo | | |Url: putPo?poid=1
Method:PUT
Body:{"poid":"Updated using RestApiz"}
DELETE:
----
- For DELETE create entry in rest api table and call rest api as follows| rest_id | method | query | url | before_query | after_query |
| -------- | ------ | ------ | --- | ------------ | ----------- |
| 1 | DELETE | delete from po where poid=;poid | deletePo | | |Url: deletePo?poid=1
Method:delete
```
from flask import Flask
import RestApiapp = Flask(__name__)
RestApi.createApi(app, host='localhost', userName='username',
password='password', database='databasename')if __name__ == "__main__":
app.run()
```Credits
---------This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
* [_Cookiecutter](https://github.com/audreyr/cookiecutter)
* [`audreyr/cookiecutter-pypackage`](https://github.com/audreyr/cookiecutter-pypackage)