已有Flask-restful的api定义:class TaskAPI(Resource):
decorators = [login_required]
def get(self, userId, taskId):
def post(self, userId, taskId):
gLog.debug("self.rootArgs=%s", self.rootArgs)
api.add_resource(UserLocationAPI, API_URL_PREFIX + ‘/users//tasks/’, endpoint = ‘userTask’)
但是对于:
想要创建新任务时,taskId为空
以POST方式去访问:
/users/user-bb22f24e-3c27-4e7b-867a-b855e139b295/tasks
/users/user-bb22f24e-3c27-4e7b-867a-b855e139b295/tasks/
都无法执行到上述接口的post中
出现:
404 Not FoundNot Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
flask-restful post 404 Not Found
->
去给add_resource,添加多个url:api.add_resource(TaskAPI,