How to document the post body using flask-ReSTplus?
I have solved it (partially) using the following model
""" Model for documenting the API"""
insert_user_data = ns_database.model(
"Insert_user_data",
{
"customer_id": fields.String(description="cust ID", required=True),
"service_id": fields.String(description="service ID", required=True),
"customer_name": fields.String(description="Customer1", required=True),
"site_name": fields.String(description="site", required=True),
"service_type": fields.String(description="service", required=True),
},
)
@ns_database.route("/insert_user")
class database(Resource):
@ns_database.expect(insert_user_data)
def post(self):
"""insert data"""
json_data = request.json
customer_id = json_data["customer_id"]
service_id = json_data["service_id"]
customer_name = json_data["customer_name"]
site_name = json_data["site_name"]
service_type = json_data["service_type"]
now the API shows model for data input and an example