Open lus opened 3 years ago
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. ^^
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.
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.
Maybe it would be nice to be able to create a paste by just sending a POST request to the root URL (i.e. https://pasty.lus.pm) with the request body representing the raw paste content. This endpoint should only return the raw paste ID or URL; no JSON involved. This would be nice for CLI users.