Code Monkey home page Code Monkey logo

Comments (8)

daveajones avatar daveajones commented on July 20, 2024 3

I know we need to be more RESTful. No doubt about that. What's in place now is basically minimum viable product to get people started. All of these comments are great. I'll start a v1.1 API layout that we can all add to. OpenAPI is laid out with YAML if I remember correctly. I think Postman has support for it.

Having a v1.1 that conforms to OpenAPI, and then leaving the current v1.0 active seems like a good balance for those that just want quick hits without full REST, and more robust platform folks.

from docs-api.

Morgma avatar Morgma commented on July 20, 2024 2

@daveajones Is the server-side API code available in another repo?

from docs-api.

Morgma avatar Morgma commented on July 20, 2024 1

I agree that establishing RESTful conventions early on is important - proper use of HTTP verbs is key. I'm a fan of structuring complex queries against OData v4 protocol (v3 support is probably advisable also), rather than having a custom convention for query structure. Many clients will consume OData v4 readily to provide filterable grids, sort, count, pagination, etc. Complex queries can optionally be passed via the HTTP body content as well, as to avoid busting the URI length for GET requests or running into encoding problems.

Make the API self-documenting, featuring an Open API 3.0 (Swagger) metadata endpoint to facilitate automatic client code generation. A web-based, interactive API browser is always a nice touch when trying to attract new developers.

The URI needs to be a short as possible while still being easily legible - for example, "api" is already in the domain, so I believe that could be removed from the stub.

The API version could either an optional query parameter or HTTP header (defaulting to the latest). I imagine the write-end of this API could face some significant breaking changes, especially early on, however, the read-end should strive to be very forward compatible - accessing beta features or pinning code to a specific release becomes a consumer option, but not a requirement.

Combined with making use of pluralization in the semantics, the API can be pretty intuitive:

GET api.podcastindex.org/podcasts
GET api.podcastindex.org/podcast/1/episodes?ver='0.1.0.254-beta'
GET api.podcastindex.org/podcast/3/episode/1

...and to scratch the query itch with something more complex, collections can be handled via OData:

GET api.podcastindex.org/podcasts?$filter=contains(name, 'Some Agenda')&$expand=episodes($filter=lastUpdateTime gt '2020-01-01')

Following on with RESTful conventions, we can really expand into quality of life improvements for developers, like enriching the response body with navigational properties to downstream entity queries - e.g. HATEOAS (Hypermedia as the Engine of Application State) - this could really help simplify client SDK development, because you can recurse through the entity definition even if the link refs have to change later on.

from docs-api.

sarbogast avatar sarbogast commented on July 20, 2024 1

from docs-api.

podcastindex avatar podcastindex commented on July 20, 2024 1

@daveajones Is the server-side API code available in another repo?

Not yet. It's a custom framework, so let me figure out the best way to split it up and I'll put something up.

from docs-api.

normand1 avatar normand1 commented on July 20, 2024

@daveajones +1 for Open API spec. I've found this tool really helpful for building out OpenAPI specs btw: https://stoplight.io/

from docs-api.

mikhey avatar mikhey commented on July 20, 2024

This looks like an interesting tool to use that could take the doctrine code comments and generate the OpenAPI/Swagger json file from our own code documentation: http://zircote.github.io/swagger-php/.

from docs-api.

daveajones avatar daveajones commented on July 20, 2024

That is an interesting tool. I need to start testing that. Thank you for passing along.

from docs-api.

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.