项目作者: Elzawawy

项目描述 :
Simple Restful Flask API (Python) for campaigns.
高级语言: Python
项目地址: git://github.com/Elzawawy/campaign-flask-api.git
创建时间: 2019-07-09T01:54:34Z
项目社区:https://github.com/Elzawawy/campaign-flask-api

开源协议:MIT License

下载


CampaignAPI

Getting the flavor of using FLask application server and backend development in Python. Can be useful for beginners on the road.

Requirements

  • To create a RESTful campaign resource, Campaign data will be (Name, Country,….).
  • If category is not provided you need to extract it from the dummy category extraction service. Here

  • Also, to visulaize the data based on some paramters passed on in the query and show it up in a UI generated.

Using my RESTful API

To run the API server.
execute the command “python api_server.py”

There is 5 Endpoints in the Server:

  1. [‘Get’] http://127.0.0.1:5000/campaign/api/

  2. [‘Post’] http://127.0.0.1:5000/campaign/api/

  3. [‘Put’] http://127.0.0.1:5000/campaign/api/

  4. [‘Delete’] http://127.0.0.1:5000/campaign/api/

  5. [‘Post’] http://127.0.0.1:5000/campaign/visualize/

Usage Extra Notes

  1. This is a paarmeter input for the name of the campagin. (The ID of the database)

  2. For Post and Put you enter your params in the body of request using Postman or any other utility as a JSON object including the columns of data.

E.g
{
“name”: “n6”,
“country”: “USA”,
“budget”: 149,
“goal”: “Success”,
“category”: “Sports”
}

  1. For Visualizing Endpoint:

E.g:
{
“dimensions”: “country”,
“fields”: [“goal”,”name”]
}

where, Dimensions and Fields both can be an array of data colns and Dimensions are used to group data by these fields
while Fields is the array of fields to return in each campaign.