I am not sure if it is possible to allow non-puppet client to do command "replace facts" into puppetdb. I tried "replace facts" puppetdb API, and kept getting the following errors:
2013-06-28 02:20:25,003 ERROR [command-proc-94] [puppetdb.command] [9e05098c-6088-428e-92bd-fbb68cc63387] [replace facts] Retrying after attempt 11, due to: java.lang.AssertionError: Assert failed: (string? certname)
It is supported, but the documentation doesn’t show good examples on how to do this yourself: http://docs.puppetlabs.com/puppetdb/latest/api/commands.html. Here is a snippet that worked for me:
Of special note, is the ‘payload’ contents in JSON are escaped, this is because its a JSON string inside another JSON string, so you have to serialize the payload part.