Last active
August 29, 2015 14:03
-
-
Save tbalthazar/05237af3eaf1ebba951d to your computer and use it in GitHub Desktop.
Harvest API bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Create an invoice via the Web UI, and paste its ID here | |
# Also, fill in the SUBDOMAIN, USERNAME and PASSWORD values. | |
INVOICE_ID = '' | |
SUBDOMAIN = '' | |
USERNAME = '' | |
PASSWORD = '' | |
def curl_cmd(message, action) | |
`curl -s -H \"Content-Type: application/json\" -H \"Accept: application/json\" -d '{\"invoice_message\":{\"body\":\"#{message}\"}}' -u \"#{USERNAME}:#{PASSWORD}\" https://#{SUBDOMAIN}.harvestapp.com/invoices/#{INVOICE_ID}/messages/#{action}` | |
end | |
# mark invoice as sent | |
curl_cmd('sent message', 'mark_as_sent') | |
# mark invoice as closed | |
curl_cmd('closed message', 'mark_as_closed') | |
# reopen invoice | |
curl_cmd('reopen message', 're_open') | |
# mark invoice as draft | |
curl_cmd('draft message', 'mark_as_draft') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment