Giter VIP home page Giter VIP logo

Comments (27)

larsks avatar larsks commented on June 23, 2024 1

Just adding a comment to this old question:

You can send the stdout of something to hastebin like this:

somecommand | curl --data-binary@- https://hastebin.com/documents

That will return a JSON repsonse that looks something like:

{"key":"oxekofidik"}

And you can turn that into a URL by appending the value to https://hastebin.com. That is, the URL for this example would be https://hastebin.com/oxekofidik. This is an unfortunate api, because it makes hastebin difficult to use from the command line with some code to handle extracting the key from the response and generate a URL.

A simple shell script that handles this might look like:

#!/bin/bash

result=$(curl -sf --data-binary @${1:--} https://hastebin.com/documents) || {
	echo "ERROR: failed to post document" >&2
	exit 1
}

key=$(jq -r .key <<< $result)

echo "https://hastebin.com/${key}"

Assuming the script is named hastebin, running it looks like:

$ echo look ma no hands | hastebin
https://hastebin.com/lubiveyuni

Or:

$ hastebin README.md 
https://hastebin.com/carateheki


It would be useful if hastebin were to implement support for the http PUT method at this endpoint, and then return a URL. This would allow convenient use of curl's -T command line option without any additional wrapper. Posting a file would look like:

curl -Tmyfile https://hastebin.com/documents

And posting stdin would look like:

curl -T- https://hastebin.com/documents

It would also make sense to implement the api on / instead of /documents, because this would reduce the amount of typing by 25%. Support posting over plain http:// and you could just write:

curl -T- hastebin.com

Which would be awesome, and is short enough that it doesn't really make sense to write a dedicated client anymore. In fact, chunk.io does exactly this, and it is super convenient.

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Sorry, not sure I understand

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

How would I want to post a paste without actually going on the website. Something like..

example.com:7777/?data=[the paste]

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024
curl -XPOST http://hastebin.com/documents -d'like this'

or you should also check out haste-client, a more user-friendly tool:

https://github.com/seejohnrun/haste-client

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Is there a way to do this with like, ShareX?

http://code.google.com/p/sharex/

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

No one has built a windows file helper like that yet, but I'm sure it's possible
You can create a paste from any computer with an internet connection

This only works on command line, but is a good resource to check out:
https://github.com/ajryan/WinHaste

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Also if someone ends up creating something like this, I'd be glad to check it over and link from the README

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Sorry if this sounds dumb, but sharex requires an "argument" and the value.
The value is %input since its what the clipboard contains however the argument needs to be a field like thing for hastebin.com that basically writes to a hastebin.
This is what it looks like with a random "name argument"
http://hastebin.com/riqemuciwu
My current settings: http://i.imgur.com/xF2zHjf.png

Sorry if this question is dumb :/ I'm not very into HTTP and webdev.

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Heya - not dumb.
Hastebin doesn't currently support form-data request bodies.
Does ShareX provide a way to have a non-form-data body (just flat text)?
That's what you'd be looking for - if not we can probably re-open this ticket and get this feature in

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Unfortunately not that I know of :/

Thanks tho! Also hastebin is awesome <3

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Thanks - I'll see what I can get together

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Thanks mate!

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Just wondering if you have an ETA ish for this? <3

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Most likely this weekend

On Fri, Feb 7, 2014 at 8:59 AM, Amir Omidi [email protected] wrote:

Just wondering if you have an ETA ish for this? <3

Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-34438296
.

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Uh just a bump xD

from haste-server.

aaomidi avatar aaomidi commented on June 23, 2024

Bump

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

all set @aaomidi - and i'll be deploying this to hastebin.com later today

from haste-server.

ddavison avatar ddavison commented on June 23, 2024

@seejohnrun any api doc on this POST impl?

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Some basic details can be seen here - hope it helps:
https://github.com/seejohnrun/haste-server/wiki/POST-api

from haste-server.

ddavison avatar ddavison commented on June 23, 2024

Getting a 500 Internal Server Error with message Error adding document when using:

{"url":"http://hastebin.com/documents","headers":{"User-Agent":"atom-rest-client","Content-Type":"text/plain; charset=utf-8"},"method":"POST","body":"some text"}

very simple request, using that api.. not working :(

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

works for me:

curl -XPOST 'http://hastebin.com/documents' -d'hello world'

What tool are you using?

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

can you give some more detail on this - these requests are working for me
using very simple curl

On Fri, Sep 12, 2014 at 10:46 AM, Amir Omidi [email protected]
wrote:

Okay so apparently you need to load it on the RAW output first, then it
loads on the normal website too?


Reply to this email directly or view it on GitHub
#54 (comment)
.

from haste-server.

ddavison avatar ddavison commented on June 23, 2024

It's been working for me. works for my atom package. https://github.com/ddavison/kinetic

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Thanks for the update @ddavison - and glad it's working!

from haste-server.

XenRevo avatar XenRevo commented on June 23, 2024

Could someone give me an example of how to do this using a form and submitting with PHP?

from haste-server.

trusktr avatar trusktr commented on June 23, 2024

I'm trying

curl -XPOST 'http://hastebin.com/documents' -d'hello world'

in macOS, but it returns nothing. It should output the json string to stdout?

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

from haste-server.

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.