Skip to content


Fixed JSON bug and made a short explanation about API #3

merged 4 commits into from

2 participants



Somebody on Reddit was talking about this project, and they wanted an API for integration with Powershell. I initially wanted to add that functionality, but I saw an API-controller that didn't do much, and saw an opportunity to use the PasswordController for it instead.

Let me know what you think.



Hi Kasper - this looks great/thanks!

One request though, could you remove the .rvmrc from the pull request? I think you added that by mistake.


Oh, I did a git add -A, and it also added the .rvmrc, but it is removed now :-)


Awesome thanks! I'll update before EOD today.

@pglombardo pglombardo merged commit c2bd7e6 into pglombardo:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
@@ -21,6 +21,26 @@ If you want to run the site on a different port, use the -p parameter.
bundle exec rails server -p 80
+## API
+You can generate passwords through an API, if you want to automate creation, it is done by hitting the password action with a POST-request. In the development environment you can use this address:
+And you will have to send these POST variables:
+password[payload]: test
+password[expire_after_days]: 60
+password[expire_after_views]: 1337
+You can test it in your browsers javascript console by going to the frontpage of Password Pusher and type:
+ $.post('',{ 'password[payload]': 'test', 'password[expire_after_days]': '60', 'password[expire_after_views]': '1337' }, function(data) { alert(data.url_token) } )
+Or do it with curl:
+ curl -d -X POST --data "password[payload]=payload&password[expire_after_days]=60&password[expire_after_views]=1337"
## Potential Quick Start Errors
### Command not found: bundle
2  app/controllers/passwords_controller.rb
@@ -105,7 +105,7 @@ def create
respond_to do |format|
format.html { redirect_to "/p/#{@password.url_token}", :notice => "The password has been pushed." }
- format.json { render :json => @password, :status => :created, :location => @password }
+ format.json { render :json => @password, :status => :created }
format.html { render :action => "new" }
format.json { render :json => @password.errors, :status => :unprocessable_entity }
1  db/schema.rb
@@ -1,3 +1,4 @@
+# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
Something went wrong with that request. Please try again.