Coder Social home page Coder Social logo

Comments (8)

chrizandr avatar chrizandr commented on June 9, 2024 2

As applications for GSoC have started, here is a document I wrote regarding possible solutions and other specifications for the design.
Your feedback and views are highly appreciated. The document allows comments so please feel free to write your suggestions

https://docs.google.com/document/d/1YjGPwoIQh9af3OdppSBmCHaEAez8kMRy-9F9WXttQiw/edit?usp=sharing

I will write the final proposal once I get feedback from mentors on this document.

Looking forward to working with you,

Regards,

from hydrus.

pchampin avatar pchampin commented on June 9, 2024 1

<nitpicking>
creating a new object whould be either

  • POST /api/cots/
    or
  • PUT /api/cots/<id> (with a fresh id)
    </nitpicking>

from hydrus.

ddxgz avatar ddxgz commented on June 9, 2024 1

Should it go strictly follow the REST including HATEOAS, or apply flexibly?

For creating a new object, I prefer using only POST (user specified ID could be contained in the post data body), since when doing a PUT to /objects/<id>, the target object should be already existed.

from hydrus.

fractos avatar fractos commented on June 9, 2024 1

Just as an aside, when we were creating the Hydra API for the DLCS project (https://dlcs.info) we used the RESTful guidelines in this set of articles, which helped answer a few questions that seemed to be ambiguous about how to organise the URLs: http://restful-api-design.readthedocs.io/en/latest/intro.html

The API we have has a URL scheme like the following:

https://api.dlcs.io/customers/{customer-id}/spaces/{space-id}/images/{image-id}

The inclusion of the customers/spaces/images parts of the URL allow easily defined endpoints to POST t (and receive a Location header back), while the {xxx-id} parts are the endpoints for PUT/PATCH/DELETE. GET allowed on both, yielding a paged collection or an entity.

from hydrus.

pchampin avatar pchampin commented on June 9, 2024 1

from hydrus.

Mec-iS avatar Mec-iS commented on June 9, 2024

@pchampin I am opinionated in using PUT (:
In term of fluency POST always sounds very generic to me compared to PUT and PATCH.
But for sure we can implement both.

from hydrus.

pchampin avatar pchampin commented on June 9, 2024

I agree about POST being very (too?) generic, and I too like PUT for creating new resources (and PATCH for modifying them without sending the whole representation).

But my point was: if you are using PUT to create a resource, then you must address the request to the IRI of the to-be-created resource (hence the <id> in the target IRI). If you don't/can't know in advance that IRI, this can't be a PUT, and so I know no better solution than POST...

from hydrus.

Mec-iS avatar Mec-iS commented on June 9, 2024

Sorry, I forgot the id as a URL parameters for PUTs.

Yeah, that's why we should support both. If the user for his/her own sake wants to give a particular id (that is the right range for the API) he/she can do it; otherwise they can use POST and get an auto-assigned id.

from hydrus.

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.