[manual] Change API URLs to be based on api.humbughq.com/api.

This must be deployed after we update our running nginx configuration
to serve api.humbughq.com.

(imported from commit b5c34ebdd595f55eecd6dca6a18a37f105107bd5)
This commit is contained in:
Tim Abbott
2013-06-24 15:48:32 -04:00
parent f06bc771a9
commit ea8a80603a
13 changed files with 25 additions and 22 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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,

View File

@@ -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:

View File

@@ -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)

View File

@@ -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"

View File

@@ -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')

View File

@@ -64,7 +64,7 @@ to pull out the resulting HTML :)
{% endcomment %}
<h4>Stream message</h4>
<div class="codehilite"><pre>curl https://humbughq.com/api/v1/messages <span class="se">\</span>
<div class="codehilite"><pre>curl https://api.humbughq.com/v1/messages <span class="se">\</span>
-u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class="se">\</span>
-d <span class="s2">"type=stream"</span> <span class="se">\</span>
-d <span class="s2">"to=Denmark"</span> <span class="se">\</span>
@@ -73,7 +73,7 @@ to pull out the resulting HTML :)
</pre></div>
<h4>Private message</h4>
<div class="codehilite"><pre>curl https://humbughq.com/api/v1/messages <span class="se">\</span>
<div class="codehilite"><pre>curl https://api.humbughq.com/v1/messages <span class="se">\</span>
-u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class="se">\</span>
-d <span class="s2">"type=private"</span> <span class="se">\</span>
-d <span class="s2">"to=wdaher@humbughq.com"</span> <span class="se">\</span>

View File

@@ -21,7 +21,7 @@
],
"example_request": {
"python": "<div class=\"codehilite\"><pre><span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">get_messages<span class=\"p\">()</span>\n</span></pre></div>",
"curl": "<div class=\"codehilite\"><pre>curl -G https://humbughq.com/api/v1/messages/latest <span class=\"se\">\\</span>\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"last=102345\"</span>\n</pre></div>"
"curl": "<div class=\"codehilite\"><pre>curl -G https://api.humbughq.com/v1/messages/latest <span class=\"se\">\\</span>\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"last=102345\"</span>\n</pre></div>"
}
},
{
@@ -54,7 +54,7 @@
],
"example_request": {
"python": "<div class=\"codehilite\"><pre>\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">({</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"private\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"wdaher@humbughq.com\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"I come not, friends, to steal away your hearts.\"</span>\n<span class=\"p\">}</span>)\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">(</span><span class=\"n\"><span class=\"p\">{</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"stream\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"Denmark\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"subject\"</span><span class=\"p\">:</span> <span class=\"s\">\"Castle\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"Something is rotten in the state of Denmark.\"</span>\n<span class=\"p\">}</span></span><span class=\"p\">)</span>\n</pre></div>\n",
"curl": "<h5>Stream message</h5>\n<div class=\"codehilite\"><pre>curl https://humbughq.com/api/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=stream\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=Denmark\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"subject=Castle\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=Something is rotten in the state of Denmark.\"</span>\n</pre></div>\n<h5>Private message</h5>\n<div class=\"codehilite\"><pre>curl https://humbughq.com/api/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=private\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=wdaher@humbughq.com\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=I come not, friends, to steal away your hearts.\"</span>\n</pre></div>"
"curl": "<h5>Stream message</h5>\n<div class=\"codehilite\"><pre>curl https://api.humbughq.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=stream\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=Denmark\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"subject=Castle\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=Something is rotten in the state of Denmark.\"</span>\n</pre></div>\n<h5>Private message</h5>\n<div class=\"codehilite\"><pre>curl https://api.humbughq.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=private\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=wdaher@humbughq.com\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=I come not, friends, to steal away your hearts.\"</span>\n</pre></div>"
}
}
]

View File

@@ -254,7 +254,7 @@ following, to the stream <code>commits</code> with a subject that matches the re
</p>
<p>Give your new web hook a name, and for the URL provide the following:</p>
<p>
<code>https://humbughq.com/api/v1/external/jira?api_key=abcdefgh&amp;stream=jira</code>
<code>https://api.humbughq.com/v1/external/jira?api_key=abcdefgh&amp;stream=jira</code>
</p>
<p>where <code>api_key</code> is the API key of the user you
@@ -381,7 +381,7 @@ key=NAGIOS_BOT_API_KEY
<p>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 <code>Activity Web Hook</code> section, and enter the following url:</p>
<p><code>https://humbughq.com/api/v1/external/pivotal?api_key=abcdefgh&amp;stream=pivotal</code></p>
<p><code>https://api.humbughq.com/v1/external/pivotal?api_key=abcdefgh&amp;stream=pivotal</code></p>
<p>where <code>api_key</code> is the API key of the user you
want updates to be sent as, and <code>stream</code> is the stream name you want the notifications sent to, and the stream must already exist.</p>