Code Monkey home page Code Monkey logo

Comments (3)

zekroTJA avatar zekroTJA commented on August 23, 2024

Nice Idea, but why no JSON involved? I mean, you can always use jq for that stuff:

curl -Ls -X POST https://pasty.lus.pm -d @snippet.txt | jq .id

That allows users to use further information like the deletion token. But yeah, than you can also just use the /pastes endpoint in your script if you really want, I guess. ^^

from pasty.

lus avatar lus commented on August 23, 2024

Yeah, I am also quite unsure about that. It would be just another endpoint to implement and we would end up with 4 different ways of creating endpoints (root URL, hastebin support, API v1 ad API v2). Maybe it's not even that reasonable.

from pasty.

zekroTJA avatar zekroTJA commented on August 23, 2024

Another approach would be to use the Accept header. So if you specify application/json as Accept header value, you get a fully hydrated JSON response. Otherwise, if you do not specify any Accept header or if you pass text/plain, you simply get a Paste URL or ID like you originally supposed. Which one of these is set as default is up to you, but should not differ across the whole API in my opinion in order to maintain consistency.

from pasty.

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.