diff --git a/api/examples/curl-examples b/api/examples/curl-examples index 6d39afcab9..033c0b6638 100755 --- a/api/examples/curl-examples +++ b/api/examples/curl-examples @@ -1,14 +1,13 @@ #!/bin/sh # Two quick API tests using curl -curl https://humbughq.com/api/v1/send_message \ +curl https://api.humbughq.com/v1/send_message \ -d "api-key=BOT_API_KEY" \ -d "email=BOT_EMAIL" \ -d "type=private" -d "content=test" \ -d "to=RECIPIENT_EMAIL" -curl https://humbughq.com/api/v1/get_messages \ +curl https://api.humbughq.com/v1/get_messages \ -d "api-key=BOT_API_KEY" \ -d "email=BOT_EMAIL" -# Or replace https://humbughq.com with your local test instance diff --git a/api/humbug/__init__.py b/api/humbug/__init__.py index 10971ecdf3..aa0a705510 100644 --- a/api/humbug/__init__.py +++ b/api/humbug/__init__.py @@ -41,7 +41,7 @@ assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1')) # In newer versions, the 'json' attribute is a function, not a property requests_json_is_function = callable(requests.Response.json) -API_VERSTRING = "/api/v1/" +API_VERSTRING = "/v1/" def generate_option_group(parser): group = optparse.OptionGroup(parser, 'API configuration') @@ -94,7 +94,9 @@ class Client(object): site = "https://" + site self.base_url = site else: - self.base_url = "https://humbughq.com" + self.base_url = "https://api.humbughq.com" + if self.base_url != "https://api.humbughq.com" and not self.base_url.endswith("/api"): + self.base_url += "/api" self.retry_on_errors = retry_on_errors self.client_name = client diff --git a/api/integrations/git/humbug_git_config.py b/api/integrations/git/humbug_git_config.py index 3e0cda3ff8..6d5517c739 100644 --- a/api/integrations/git/humbug_git_config.py +++ b/api/integrations/git/humbug_git_config.py @@ -54,4 +54,4 @@ def commit_notice_destination(repo, branch, commit): HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com" diff --git a/api/integrations/svn/humbug_svn_config.py b/api/integrations/svn/humbug_svn_config.py index 4de0376c0a..814ae94e98 100644 --- a/api/integrations/svn/humbug_svn_config.py +++ b/api/integrations/svn/humbug_svn_config.py @@ -54,4 +54,4 @@ def commit_notice_destination(path, commit): HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com" diff --git a/api/integrations/trac/humbug_trac_config.py b/api/integrations/trac/humbug_trac_config.py index 4b2d0f9cb1..af646f17a2 100644 --- a/api/integrations/trac/humbug_trac_config.py +++ b/api/integrations/trac/humbug_trac_config.py @@ -49,4 +49,4 @@ TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com" diff --git a/bots/check-mirroring b/bots/check-mirroring index 7b91c9501f..e3530bd694 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -15,7 +15,7 @@ parser.add_option('--verbose', action='store_true') parser.add_option('--site', dest='site', - default="https://humbughq.com", + default="https://api.humbughq.com", action='store') parser.add_option('--sharded', default=False, diff --git a/bots/feedback-bot b/bots/feedback-bot index b43a268748..10513019d5 100755 --- a/bots/feedback-bot +++ b/bots/feedback-bot @@ -36,12 +36,12 @@ prod_client = humbug.Client( email="feedback@humbughq.com", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", verbose=True, - site="https://humbughq.com") + site="https://api.humbughq.com") staging_client = humbug.Client( email="feedback@humbughq.com", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", verbose=True, - site="https://staging.humbughq.com") + site="https://staging.humbughq.com/api") def forward_message(message): if message["type"] != "private" or len(message["display_recipient"]) != 2: diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 419affa675..5f3bf65060 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -70,7 +70,7 @@ class RandomExponentialBackoff(CountingBackoff): print message time.sleep(delay) -DEFAULT_SITE = "https://humbughq.com" +DEFAULT_SITE = "https://api.humbughq.com" class States: Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4) diff --git a/servers/puppet/modules/humbug/files/munin-plugins/humbug_send_receive b/servers/puppet/modules/humbug/files/munin-plugins/humbug_send_receive index a78bed3e97..b265981982 100755 --- a/servers/puppet/modules/humbug/files/munin-plugins/humbug_send_receive +++ b/servers/puppet/modules/humbug/files/munin-plugins/humbug_send_receive @@ -2,6 +2,6 @@ if [ "$(hostname)" = "staging.humbughq.com" ]; then site="https://staging.humbughq.com" else - site="https://humbughq.com" + site="https://api.humbughq.com" fi /home/humbug/humbug-deployments/current/bots/check_send_receive.py --munin $1 --site="$site" diff --git a/servers/puppet/modules/humbug/files/nagios_plugins/check_send_receive_time b/servers/puppet/modules/humbug/files/nagios_plugins/check_send_receive_time index 53159fe7ee..c21630de82 100755 --- a/servers/puppet/modules/humbug/files/nagios_plugins/check_send_receive_time +++ b/servers/puppet/modules/humbug/files/nagios_plugins/check_send_receive_time @@ -26,7 +26,7 @@ usage = """Usage: send-receive.py [options] [config] parser = optparse.OptionParser(usage=usage) parser.add_option('--site', dest='site', - default="https://humbughq.com", + default="https://api.humbughq.com", action='store') parser.add_option('--nagios', @@ -92,26 +92,28 @@ if options.site == "staging.humbughq.com": sender_key = "dfe1c934d555f4b9538d0d4cfd3069c2" recipient = "othello@humbughq.com" recipient_key = "4e5d97591bec64bf57d2698ffbb563e3" + site = "https://staging.humbughq.com/api" else: # cordelia and iago are default users on prod sender = "iago@humbughq.com" sender_key = "d43b53c27a8106195b46781abc67901a" recipient = "cordelia@humbughq.com" recipient_key = "24cf18de98d5c31da9c6c79f0cbec195" + site = "https://api.humbughq.com" humbug_sender = humbug.Client( email=sender, api_key=sender_key, verbose=True, client="test: Humbug API", - site=options.site) + site=site) humbug_recipient = humbug.Client( email=recipient, api_key=recipient_key, verbose=True, client="test: Humbug API", - site=options.site) + site=site) max_message_id = humbug_recipient.get_profile().get('max_message_id') diff --git a/templates/zephyr/api.html b/templates/zephyr/api.html index 4c9508594f..e5cc0cc91e 100644 --- a/templates/zephyr/api.html +++ b/templates/zephyr/api.html @@ -64,7 +64,7 @@ to pull out the resulting HTML :) {% endcomment %}

Stream message

-
curl https://humbughq.com/api/v1/messages \
+
curl https://api.humbughq.com/v1/messages \
     -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
     -d "type=stream" \
     -d "to=Denmark" \
@@ -73,7 +73,7 @@ to pull out the resulting HTML :)
 

Private message

-
curl https://humbughq.com/api/v1/messages \
+
curl https://api.humbughq.com/v1/messages \
     -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
     -d "type=private" \
     -d "to=wdaher@humbughq.com" \
diff --git a/templates/zephyr/api_content.json b/templates/zephyr/api_content.json
index 41edcef671..0d6c50de8c 100644
--- a/templates/zephyr/api_content.json
+++ b/templates/zephyr/api_content.json
@@ -21,7 +21,7 @@
         ],
         "example_request": {
             "python": "
client.get_messages()\n
", - "curl": "
curl -G https://humbughq.com/api/v1/messages/latest \\\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \\\n -d \"last=102345\"\n
" + "curl": "
curl -G https://api.humbughq.com/v1/messages/latest \\\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \\\n -d \"last=102345\"\n
" } }, { @@ -54,7 +54,7 @@ ], "example_request": { "python": "
\nclient.send_message({\n    \"type\": \"private\",\n    \"to\": \"wdaher@humbughq.com\",\n    \"content\": \"I come not, friends, to steal away your hearts.\"\n})\nclient.send_message({\n    \"type\": \"stream\",\n    \"to\": \"Denmark\",\n    \"subject\": \"Castle\",\n    \"content\": \"Something is rotten in the state of Denmark.\"\n})\n
\n", - "curl": "
Stream message
\n
curl https://humbughq.com/api/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=stream\" \\\n    -d \"to=Denmark\" \\\n    -d \"subject=Castle\" \\\n    -d \"content=Something is rotten in the state of Denmark.\"\n
\n
Private message
\n
curl https://humbughq.com/api/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=private\" \\\n    -d \"to=wdaher@humbughq.com\" \\\n    -d \"content=I come not, friends, to steal away your hearts.\"\n
" + "curl": "
Stream message
\n
curl https://api.humbughq.com/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=stream\" \\\n    -d \"to=Denmark\" \\\n    -d \"subject=Castle\" \\\n    -d \"content=Something is rotten in the state of Denmark.\"\n
\n
Private message
\n
curl https://api.humbughq.com/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=private\" \\\n    -d \"to=wdaher@humbughq.com\" \\\n    -d \"content=I come not, friends, to steal away your hearts.\"\n
" } } ] \ No newline at end of file diff --git a/templates/zephyr/integrations.html b/templates/zephyr/integrations.html index cf1b99273e..edb8cd1195 100644 --- a/templates/zephyr/integrations.html +++ b/templates/zephyr/integrations.html @@ -254,7 +254,7 @@ following, to the stream commits with a subject that matches the re

Give your new web hook a name, and for the URL provide the following:

- https://humbughq.com/api/v1/external/jira?api_key=abcdefgh&stream=jira + https://api.humbughq.com/v1/external/jira?api_key=abcdefgh&stream=jira

where api_key is the API key of the user you @@ -381,7 +381,7 @@ key=NAGIOS_BOT_API_KEY

Humbug supports Pivotal Tracker integration and can notify you of changes to the stories in your Pivotal Tracker project. In the Settings page for your project, choose the Integrations tab. Scroll down to the Activity Web Hook section, and enter the following url:

-

https://humbughq.com/api/v1/external/pivotal?api_key=abcdefgh&stream=pivotal

+

https://api.humbughq.com/v1/external/pivotal?api_key=abcdefgh&stream=pivotal

where api_key is the API key of the user you want updates to be sent as, and stream is the stream name you want the notifications sent to, and the stream must already exist.