Giter Club home page Giter Club logo

Comments (4)

kevinburke avatar kevinburke commented on September 24, 2024

how do you anticipate using this? what would you expect the interface to look like?

from flask-restful.

cassava avatar cassava commented on September 24, 2024

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.

kevinburke avatar kevinburke commented on September 24, 2024

We're trying to move toward providing Links natively soon.

from flask-restful.

dougblack avatar dougblack commented on September 24, 2024

Fixed by #110.

from flask-restful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.