0

I have a variable i want to store in a pastebin so i found this but the link to the API isn't working.

I was wondering if it would be possible to store a variable in a pastebin file so when you go to the site on another computer it gets the value from pastebin and makes it the variable

e.g.

var posts = <Link to pastebin>

user makes a post so it edits the pastebin

so when another user gets on the site they can see what the other user post.

Community
  • 1
  • 1
pfych
  • 850
  • 1
  • 13
  • 32
  • 1
    Surely there will be a way doing that. Have you tried using the API (http://pastebin.com/api/)? – dhh Jul 06 '15 at 05:25
  • that does not let you edit or read, only create. – pfych Jul 06 '15 at 05:27
  • 1
    At least, in the JS-API-Wrapper (https://github.com/j3lte/pastebin-js) listed here (http://pastebin.com/tools#pastebinnode) there is the `getPaste`-method which allows reading. – dhh Jul 06 '15 at 05:32
  • Might use that. Now i just need to find a way to write to a pastebin – pfych Jul 06 '15 at 05:33
  • 1
    There is another node-module out there: https://www.npmjs.com/package/better-pastebin. It seems to provide possibilities to edit pastes. I did not find any other information on how to edit pastes using the api - maybe you can try deleting and re-creating the paste on every change. – dhh Jul 06 '15 at 05:40
  • nice! I have 0 idea how to use it though – pfych Jul 06 '15 at 05:43
  • 1
    Just try and return if you got details. Then please add your code and detailled error messages / problem descriptions. – dhh Jul 06 '15 at 05:45
  • 1
    Alternatively you could use Google Drive, for storing such variable. – pokeybit Jul 06 '15 at 05:57
  • How would i do this? – pfych Jul 07 '15 at 06:48

1 Answers1

1

Currently there is no API for editing pastes directly.

You can create or delete them using the api (wrappers for JS exist here and here, API docs are provided here). There are lots of other examples on how to use the api listed here.

If you do not use the node modules listed above, you can have a look into that code at here - they do not use the api for editing, they do post the forms manually.

dhh
  • 4,289
  • 8
  • 42
  • 59