Haiku API Advanced

Get Activation Info

Add-on activation returns callback_url. A GET will return additional information about the activation. Note that some of this information such as owner_email could change without notice, so be sure to check this endpoint before sending e-mail.

Response Parameters

Name Description
callback_url An API URL specific to this activation that the Add-on can use for more information
config The set of config vars currently set for this activation
domains (ignored) provided for compatability
ey_id A Unique ID for the activation event
heroku_id ey_id and name concatenated, provided for compatability
id same as heroku_id, provided for compatability
invoices_url A URL for sending discrete billing events, see description of Invoices API
logplex_token (ignored) provided for compatability
name A name that may be useful if you are creating something for the user. For example: database name, account name, etc.. (not guaranteed to be unique)
options (ignored) provided for compatability
owner_email The e-mail address of the first account owner, provided for compatability
owner_emails The e-mail addresses of all account owners
plan The api_name of the plan selected by the user
region (ignored) provided for compatability

Example Request

Headers

Accept: application/json
Date: Wed, 18 Dec 2013 23:32:31 GMT
Content-Type: application/x-www-form-urlencoded
Authorization: Basic bW9ja3NlcnZpY2U6OTAxYWYzMDc4NDYwMzIyMzNmNjIxMzVlZmM0M2E3NTM4
YTI2YjhiODU5OWY0NWQzY2M0ODRmMmU3OThiMTk2Nw==

Route

GET https://addons.engineyard.com/api/2/provisioned_services/1

Body

Example Response

Headers

Content-Type: application/json; charset=utf-8

Status

200

Body

{
  "ey_id": 1,
  "name": "mockservice_helloworld_production_helloworld",
  "invoices_url": "https://addons.engineyard.com/api/2/provisioned_services/1/invoices",
  "callback_url": "https://addons.engineyard.com/api/2/provisioned_services/1",
  "plan": "test",
  "heroku_id": "1-mockservice_helloworld_production_helloworld",
  "region": "NA",
  "options": {
  },
  "config": {
    "FOO": "bar"
  },
  "owner_email": "tftesting@engineyard.com",
  "owner_emails": [
    "tftesting@engineyard.com"
  ],
  "id": "1-mockservice_helloworld_production_helloworld",
  "logplex_token": "NA",
  "domains": [

  ]
}

List Activations

Construct a URL for the full list of activations by removing the id from the end of callback_url.

Response Parameters

Name Description
callback_url An API URL specific to this activation that the Add-on can use for more information
ey_id A Unique ID for the activation
heroku_id ey_id and name concatenated, provided for compatability
invoices_url A URL for sending discrete billing events, see description of Invoices API
name A name that may be useful if you are creating something for the user. For example: database name, account name, etc.. (not guaranteed to be unique)
options (ignored) provided for compatability
plan The api_name of the plan selected by the user
provider_id (ignored) provided for compatability
region (ignored) provided for compatability

Example Request

Headers

Accept: application/json
Date: Wed, 18 Dec 2013 23:32:31 GMT
Content-Type: application/x-www-form-urlencoded
Authorization: Basic bW9ja3NlcnZpY2U6OTAxYWYzMDc4NDYwMzIyMzNmNjIxMzVlZmM0M2E3NTM4
YTI2YjhiODU5OWY0NWQzY2M0ODRmMmU3OThiMTk2Nw==

Route

GET https://addons.engineyard.com/api/2/provisioned_services

Body

Example Response

Headers

Content-Type: application/json; charset=utf-8

Status

200

Body

[
  {
    "callback_url": "https://addons.engineyard.com/api/2/provisioned_services/1",
    "ey_id": 1,
    "heroku_id": "1-mockservice_helloworld_production_helloworld",
    "invoices_url": "https://addons.engineyard.com/api/2/provisioned_services/1/invoices",
    "name": "mockservice_helloworld_production_helloworld",
    "options": {
    },
    "plan": "test",
    "provider_id": 1,
    "region": "NA"
  }
]

Invoicing

Haiku Add-ons will automatically have invoices generated (and updated daily) based on the selected plan. Use this API to submit additional/overage charges. The needed invoices_url is sent in the Activation API call.

Engine Yard customers are billed once a month for charges accumulated in the previous month. Accordingly, there is a 24 hour cutoff period for submitting invoices after the month ends (GMT+8). Submitted invoices will be assigned to the nearest open billing cycle, so if you miss the cutoff the invoice will be charged the next month.

If an account cancels, you have 24 hours to submit extra invoices to that account, after that, invoices will be rejected.

Request Parameters

Name Description
line_item_description Description of the charge, will appear on customer bill
total_amount_cents Amount to charge in USD times 100 (total amount in cents)
unique_id (optional) Not show to the customer, but usefull for reconciliation. It's best to use some internal ID that uniquely identifies this billing event. If a duplicate ID is sent (within the scope of a customer) the invoice will be rejected, thus this field is useful to avoid accidental overcharges.

Response Parameters

Name Description
account_id The ID of the account that was invoiced (not that a single accounts may have multiple activations of your add-on)
invoice_date The date of the invoice (will be used to determine in which billing cycle to charge the customer)
line_item_description As sent in the request
total_amount_cents As sent in the request
unique_id As sent in the request
status "pending" or "locked" to indicate whether the invoice can be updated (or too late)
updated_at Last time this invoice was updated
url URL used to fetch or update this invoice

Example Request

Headers

Accept: application/json
Date: Wed, 18 Dec 2013 23:32:31 GMT
Content-Type: application/json
Authorization: Basic bW9ja3NlcnZpY2U6OTAxYWYzMDc4NDYwMzIyMzNmNjIxMzVlZmM0M2E3NTM4
YTI2YjhiODU5OWY0NWQzY2M0ODRmMmU3OThiMTk2Nw==

Route

POST https://addons.engineyard.com/api/2/provisioned_services/1/invoices

Body

{
  "total_amount_cents": 1299,
  "line_item_description": "Mockservice from 01 December 2013 to 31 December 2013",
  "unique_id": "6ffdc64c5ce442e38c0f5ab58d06092b"
}

Example Response

Headers

Content-Type: application/json; charset=utf-8

Status

201

Body

{
  "line_item_description": "Mockservice from 01 December 2013 to 31 December 2013",
  "total_amount_cents": 1299,
  "unique_id": "6ffdc64c5ce442e38c0f5ab58d06092b",
  "invoice_date": "2013-12-18T23:32:31.188Z",
  "updated_at": "2013-12-18T23:32:31.188Z",
  "status": "pending",
  "account_id": 1,
  "url": "https://addons.engineyard.com/api/1/partners/1/services/1/service_accounts/1/invoices/1"
}