Comments (4)
how do you anticipate using this? what would you expect the interface to look like?
from flask-restful.
According to HATEOAS, there need to be links. Consider the GitHub API itself for example: it isn't completely HATEOAS, but at least a little.
If there are links, then the API is in itself self-documenting. I suppose there could be something like a url_for
function for Flask-RESTful too, which would take the first valid link it finds for a Resource:
class MyView(Resource):
def get(self, my_id):
pass
api.add_resource(MyView, '/mine/<int:my_id>', '/mine/another/<int:my_id>')
url_for(MyView) # which returns /mine/{my_id} or maybe according to a template...
Ok, you can see I haven't thought all too much about it.
It's hard to find good examples of this... maybe this one: Sun Cloud API Example.
Anyway, I anticipate using this like so:
{
"message": "You are at the index. Check out the links!",
"links": {
"self": "/",
"issues": "/you/issues",
"repos": "/you/repos",
"posts": "/you/posts"
}
}
Or maybe like so:
{
"collection": [
{ ..., "uri": "/you/repos/1" },
{ ..., "uri": "/you/repos/2" },
{ ..., "uri": "/you/repos/3" }
],
"links": {
"self": "/you/repos",
"paginate": "/you/repos?offset={offset}&limit={limit}",
"prev_page": null,
"next_page": null
}
}
Something like that.
from flask-restful.
We're trying to move toward providing Links natively soon.
from flask-restful.
Fixed by #110.
from flask-restful.
Related Issues (20)
- Return custom error code HOT 1
- Swagger doc like FastAPI HOT 2
- Did not attempt to load JSON data because the request Content-Type was not 'application/json'. HOT 8
- Is expected behavior of flask_restful abort() correct ? HOT 1
- Question: optional/wildcard url parameter HOT 1
- Flask 2.3 Incompatibility: app.propagate_exceptions is depreciated HOT 1
- test_client.get() with query_string doesn't work HOT 1
- The app.propagate_exceptions will be deprecated in Flask 2.3
- Using reqparse.add_argument() with default location parameter to parse requests with Content-Type other than "application/json" raises an exception when using Werkzeug>=2.1.0 HOT 3
- @api.resource is used in blueprint that it is not working HOT 1
- test_redirect failure HOT 1
- sdist is missing `tox.ini`
- This is alive? HOT 1
- response header "Server' cannot modified
- Is flask-restful dead? HOT 2
- Questions about Copilot + Open Source Software Hierarchy
- Documentation out of date for compatible Python versions
- Flask-RESTful breaks with Flask 2.3 and newer HOT 1
- Frontlight debug issues
- cannot import name 'cached_property' from 'werkzeug' (/Users/lingrui/anaconda3/envs/ads-server/lib/python3.11/site-packages/werkzeug/__init__.py)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-restful.