Giter Site home page Giter Site logo

Should be a GET about schematic-ipsum HOT 3 CLOSED

afeld avatar afeld commented on September 14, 2024
Should be a GET

from schematic-ipsum.

Comments (3)

jonahkagan avatar jonahkagan commented on September 14, 2024

I thought about this a lot, but I decided it would be simpler to use as a POST request. How would you suggest sending the JSON schema if it were a GET request? The only thing I can think of is to url-encode it and attach it as a query parameter. That seemed like it would just make things more difficult for anybody who wanted to quickly curl some data like so:

curl -X POST -H "Content-Type: application/json" --data @schema.json http://schematic-ipsum.herokuapp.com

Or using HTTPie:

http POST http://schematic-ipsum.herokuapp.com < schema.json

I don't think these tools support simply reading from a file and converting the contents to a query string.

If you think about it, in a way it's sort of like you are asking the server to create a new resource based on your schema (and then also send it back). Except it's non-deterministic and you can't ever request that resource again 😁

from schematic-ipsum.

afeld avatar afeld commented on September 14, 2024

Gotcha. Since supporting both methods is trivial I'd probably just handle the encoded JSON query param, in case it makes someone's life easier (for some reason).

from schematic-ipsum.

jonahkagan avatar jonahkagan commented on September 14, 2024

I also just realized that the GET request currently loads the HTML page that describes the service, so I'd have to put the API at some other path if I wanted to support GET. I think I'll just wait and see if anybody needs the GET version, and if they request it, then I'll think about how to support it. Closing for now.

from schematic-ipsum.

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.