Git Product home page Git Product logo

Comments (3)

phalt avatar phalt commented on August 28, 2024

Maybe for created and edited, but the url attribute it vital for HATEOAS and I personally think it should be a direct attribute on the resource and not nested.

from swapi.

buro9 avatar buro9 commented on August 28, 2024

I'd agree with the view that the "self" URL is special.

I've done both things... adding it as the first property on a resource, and also adding it as a "self" URL on a list of links about the resource (taking the view that philosophically the URL doesn't really describe the resource but is a property of the system storing the resource)

Example of a "meta" object on a large and complex API:

"meta":{
   "created": "2013-04-11T05:52:46.362755Z",
   "createdBy": {
      ...
   },
   "flags": {
      "sticky": false,
      "open": true,
      "deleted": false,
      "moderated": false,
      "unread": true
   },
   "links":[
      {"rel":"self", "href":"/api/foos/1"},
   ],
   "permissions":{
      "create":false,
      "read":true,
      "update":false,
      "delete":false
   }
}

from swapi.

phalt avatar phalt commented on August 28, 2024

I think Meta is okay for the created and updated values. Accepted this into version 2 (whenever I find spare time to roll that out)

We don't need anything like permissions as we can just call the HTTP HEAD method on the resource and determine the CRUD actions based on the allowed HTTP methods. Also, swapi only supports GET anyway.

from swapi.

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.