Class: PartnerApi
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- PartnerApi
- Includes:
- Helpers, YottaaAuth
- Defined in:
- controllers/partners_api.rb
Overview
Overview:
Yottaa provides a robust set of partner API that allows a 3rd party partner to create and manager user accounts. The API allows partners with an existing user base to integrate Yottaa's web performance and monitoring solution.
3rd party applications wanting to use the partner API, must register for a Yottaa account and have the partner access granted. You need to contact us at <support@yottaa.com> when you want to access partner API service. Once you have been granted the partner access, you can access our partner APIs.
Authentication:
Yottaa partner API uses the API key based authentication method. You need to log in your account in Yottaa to get your API key under the account settings page. Once you get it, you can add the API key to your REST request as a HTTP Header like this:
YOTTAA-API-KEY: 7d04a0db7dcfc6afead3226fa2e86ce39fc515b0
Or you can supply the API Key in the request URL as a yottaa_api_key parameter.
You also need to add your Partner (User) ID which you will get in your account settings page as well to the request URL.
https://api.yottaa.com/partners/4e2dfb5b0fcb1530e500000b
Request that do not contain a valid API Key and Partner (User) ID will return a HTTP 403 (Access Denied) response code.
Instance Method Summary (collapse)
-
- (Object) DELETE '/partners/:partner_id/accounts/:account_id.?:response_type?'
Delete an user account.
-
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Remove monitors.
-
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/sites/:site_id.?:response_type?'
Delete site.
-
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Remove tests.
-
- (Object) GET '/partners/:partner_id/accounts.?:response_type?'
Retrieve all the accounts of a partner.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id.?:response_type?'
Retrieve an user account detailed information.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Retrieve a list of monitors.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id.?:response_type?'
Retrieve detailed information of a monitor.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/samples.?:response_type?'
Retrieve monitoring it test metrics.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/samples/:sample_id.?:response_type?'
Retrieve detailed metrics of a sample.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites.?:response_type?'
Retrieve an user's sites list.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites/:site_id.?:response_type?'
Retrieve a site overview information.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer.?:response_type?'
Retrieve usage data of site.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Retrieve test list.
-
- (Object) GET '/partners/:partner_id/accounts/:account_id/tests/:test_id.?:response_type?'
Retrieve detailed information of a test.
-
- (Object) GET /partners/:partner_id.?:response_type?
Retrieve a partner's overview information.
-
- (Object) POST '/partners/:partner_id/accounts.?:response_type?'
Create an user account for the partner.
-
- (Object) POST '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Create a monitor.
-
- (Object) POST '/partners/:partner_id/accounts/:account_id/sites.?:response_type?'
Create a new site for an account.
-
- (Object) POST '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Create a test.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id/start.?:response_type?'
Start a monitor.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id/stop.?:response_type?'
Pause a monitor.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/pause.?:response_type?'
Pause the optimizer for the site.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/resume.?:response_type?'
Resume the optimizer for the site.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/transparent.?:response_type?'
Transparent the optimizer for the site.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/update_host.?:response_type?'
Update site host.
-
- (Object) PUT '/partners/:partner_id/accounts/:account_id/update_email.?:response_type?'
Update user account email for the partner.
Instance Method Details
- (Object) DELETE '/partners/:partner_id/accounts/:account_id.?:response_type?'
Delete an user account.
Overview:
Delete an user account. If there is one or more sites associated with this account, the deletion will be failed, otherwise succeed.
URL:
partners/<partner-id>/accounts/<account-id>
Requires Authentication:
YES
HTTP Method
DELETE
Parameters:
NONE
Responses:
{
"email": "bbuffone@gmail.com",
"name": "Bob (Buffone)",
"id": "4e2dfb5b0fcb1530e500000b"
}
Examples:
Delete an account:
curl -X DELETE \\
-H 'YOTTAA-API-KEY: 1234567890abcedfghijklmn' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567890abcdefg
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Remove monitors.
Overview:
Remove monitors
URL:
partners/<partner_id>/accounts/<account_id>/monitors
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Requires Authentication:
YES
HTTP Method
DELETE
Parameters:
NONE
Body
ids: ["id1", "id2", ...]
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
-X DELETE --data "{\"ids\":[\"506297afc3666e1df8000014\"]}" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/monitors
Responses:
[
{
monitor json
}
]
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/sites/:site_id.?:response_type?'
Delete site.
Overview:
Delete a site of the account.
If the site is using optimizer, it can only be deleted when it's in preview/off status. If your are a reseller, you can also delete the site when it's in proxy only status(the site is paused), but you must make sure that you have removed the CNAME record that point to yottaa before you call this API, unless your web site will have an DNS record missing error.
URL:
partners/<partner-id>/accounts/<account-id>/sites/<site-id>
Requires Authentication:
YES
HTTP Method
DELETE
Parameters:
NONE
Responses:
{
"site_id": "4e2dfb5b0fcb1530e500000b",
}
Examples:
curl -X DELETE \\
-H 'YOTTAA-API-KEY: 1234567890abcedfghijklmn' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567891/sites/1234567890123
- (Object) DELETE '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Remove tests.
Overview:
Remove tests
URL:
partners/<partner_id>/accounts/<account_id>/tests
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Requires Authentication:
YES
HTTP Method
DELETE
Parameters:
NONE
Body
ids: [id1, id2, ...]
Examples:
curl -X DELETE \\
-H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
--data "{\"ids\":[\"506297afc3666e1df8000014\"]}" \\
https://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/tests
Responses:
[
{
test json
}
]
- (Object) GET '/partners/:partner_id/accounts.?:response_type?'
Retrieve all the accounts of a partner.
Overview:
Retrieve all the accounts of a partner, the default is to return the first (per_page) accounts, if the (page) is given in the url, it will return the accounts in that page. per_page is up to 100, default is 10.
URL:
partners/<partner-id>/accounts
Requires Authentication:
YES
HTTP Method
GET
Filtering Parameters:
**is required, others are optional:
per_page |
The maximum number of account objects that are returned for this request. Default (10) |
page |
The set of account objects that are returned. Example page=2&per_page=7. The request will return 8-14. Default (1) |
search_term |
allows you to filter the account by (name | email). Default (null) |
Sorting Parameters:
sort_by |
(name | email) - default is name |
direction |
(asc | desc) - default is desc. |
page per_page
Responses:
{
current_page: 2,
total_pages: 2,
per_page: 10,
total_entries: 17
accounts: [
{
"email": "bbuffone@yottaa.com",
"name": "Bob (Buffone)",
"id": "4e2dfb5b0fcb1530e500000b"
"api_url": "https://api.yottaa.com/partners/4e2dfb5b0fcb1530e500000b/accounts/4e2dfb5b0fcb1530e500000b"
}
]
}
Examples:
Get one partner's accounts:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts
Search one partner's accounts:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts?search_term=name&query=bob&page=2&per_page=20
- (Object) GET '/partners/:partner_id/accounts/:account_id.?:response_type?'
Retrieve an user account detailed information.
Overview:
Retrieve an user account detailed information.
URL:
partners/<partner-id>/accounts/<account-id>
Requires Authentication:
YES
HTTP Method
GET
Parameters:
NONE
Responses:
{
"email": "bbuffone@gmail.com",
"name": "Bob (Buffone)",
"id": "4e2dfb5b0fcb1530e500000b",
"created_at": "August 1, 2011 10:34",
"last_sign_in_at": "August 10, 2011 10:34",
"api_key": "50beb11fc3666e848c000048aaa"
}
Examples:
Get one accounts data:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567890abcdefg
- (Object) GET '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Retrieve a list of monitors
Overview:
Retrieve all the monitors of a user, the default is to return the first (per_page) monitors, if the (page) is given in the url, it will return the monitors in that page. per_page is up to 100, default is 10.
URL:
partners/<partner_id>/accounts/<account_id>/monitors
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Filtering Parameters:
per_page |
The maximum number of tests objects that are returned for this request. Default (10) |
page |
The set of test objects that are returned. Example page=2&per_page=7. The request will return 8-14. Default (1) |
search_term |
allows you to filter the test by name. Default (null) |
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000061/monitors
Responses:
[
rows: {
See the API for /partners/<partner_id>/accounts/<account_id>/monitors/<monitor_id>.json
}
]
- (Object) GET '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id.?:response_type?'
Retrieve detailed information of a monitor
Overview:
Retrieve detailed information of a monitor.
URL:
partners/<partner_id>/accounts/<account_id>/monitors/<monitor_id>
Parameters:
* monitor_id: the id of the account's monitor
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/monitors/5062989cc3666e1df8000019
- (Object) GET '/partners/:partner_id/accounts/:account_id/samples.?:response_type?'
Retrieve monitoring it test metrics
Overview:
Retrieve monitoring it test metrics.
URL:
partners/<partner_id>/accounts/<account_id>/samples
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Filtering Parameters:
**is required, others are optional:
**profile_and_locations |
specify some monitor/test and some locations |
per_page |
The maximum number of tests objects that are returned for this request. Default (10) |
page |
The set of test objects that are returned. Example page=2&per_page=7. The request will return 8-14. Default (1) |
Search Parameters:
All search parameters are optional.
metrics |
specify one or multi metric data to return (Array) |
from |
The beginning of the time range to search for. The value is a JavaScript date String, or UTC long vaue |
to |
The end of the time range to search for. The value is a JavaScript date String, or UTC long vaue |
location |
An array of locations to query. The location is the data_center field of the Location object.s To find the available browsers use the location API. |
sample_type |
specify which type samples to be return -1: all, 0: no issue, 1: warning issue, 2: error issue, 3: critical issue |
Parameter Example:
{
"from":"10/29/2012 00:00",
"per_page":"10",
"profile_and_locations":[
{
"profile_id":"50889e27c3666e04b9000015",
"locations":["Oregon"],
"location":"All Locations"
}
],
"to":"10/31/2012 23:59",
"page":"1",
"metrics":["time_to_interact","yottaa_score","last_byte"],
"sample_type":"-1"
}
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
"http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/samples?sample_type=-1&from=10%2F29%2F2012+00%3A00&to=10%2F31%2F2012+23%3A59&type=null&metrics%5B%5D=time_to_interact&metrics%5B%5D=yottaa_score&metrics%5B%5D=last_byte&profile_and_locations%5B0%5D%5Bprofile_id%5D=50889e27c3666e04b9000015&profile_and_locations%5B0%5D%5Blocation%5D=All+Locations&profile_and_locations%5B0%5D%5Blocations%5D%5B%5D=Oregon&per_page=10&page=1"
- (Object) GET '/partners/:partner_id/accounts/:account_id/samples/:sample_id.?:response_type?'
Retrieve detailed metrics of a sample
Overview:
Retrieve detailed metrics of a sample.
URL:
partners/<partner_id>/accounts/<account_id>/samples/<sample_id>
Parameters:
* sample_id: the id of sample
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
screenshots |
(boolean) - default is false. If you want to have the screenshots include then you must add screenshots=true |
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/samples/506297afc3666e1df8000014
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites.?:response_type?'
Retrieve an user's sites list
Overview:
Retrieve an user's sites list.
URL:
partners/<partner-id>/accounts/<account-id>/sites
Requires Authentication:
YES
HTTP Method
GET
Parameters:
NONE
Responses:
{
sites: [
{
"host": "www.google.com",
"id": "4e2dfb5b0fcb1530e500000b"
"portal_url: "https://apps.yottaa.com/dashboard/sites/4e2dfb5b0fcb1530e500000b",
"api_url": "https://api.yottaa.com/partners/4e2dfb5b0fcb1530e500000b/accounts/4e2dfb5b0fcb1530e500000c/sites/4e2dfb5b0fcb1530e500000b"
"yottaa_cname": '123456789.yottaa.org', // If site is using optimizer
"preview_url" : "https://apps.yottaa.com/framework/web/sites/4e2dfb5b0fcb1530e500000c/optimizer?first_time=true
}
]
}
Examples:
Get an account's sites list:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567890abcdefg/sites
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites/:site_id.?:response_type?'
Retrieve a site overview information
Overview:
Retrieve a site overview information.
URL:
partners/<partner_id>/accounts/<account_id>/sites/<site_id>
Requires Authentication:
YES
HTTP Method
GET
Parameters:
NONE
Responses:
{
"host": "www.google.com",
"id": "4e2dfb5b0fcb1530e500000b"
"portal_url: "https://w.yottaa.com/dashboard/sites/4e2dfb5b0fcb1530e500000b",
"optimizer": "trial",
"yottaa_cname": "1234567890abcdef.yottaa.org", // If is using optimizer
"preview_url" : "https://apps.yottaa.com/framework/web/sites/4e2dfb5b0fcb1530e500000c/optimizer?first_time=true
}
Examples:
Get one site data:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567890abcdefg/sites/abcdefg1234567890abcdefg123456
- (Object) GET '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer.?:response_type?'
Retrieve usage data of site.
Overview:
And the usage metrics will be returned as [[timestamp, value], ..]] format, and the timestamp will be UNIX timestamp in millisecond.
URL:
partners/:partner_id/accounts/:account_id/sites/<site-id>/optimizer
Requires Authentication:
YES
HTTP Method
GET
Parameters:
* start_date: format is DAY-MONTH-YEAR, ex: 23-12-2011.
* end_date: if start_date and end_date are not given, default will return the latest 48 hours usage metrics.
Responses:
-
Contains the global average of performance metrics.
{
site: www.yottaa.com,
status: preview,
metrics: {
traffic: {
Origin: { numOfReq: 174, GBS: 6754968 },
Yottaa: { numOfReq: 58, GBS: 8540391 }
}
},
usage: {
[
{
title: "Yottaa Request",
data: [
[1320105600000, 34.0],
[1320192000000, 1.0],
..
]
},
{
title: "Yottaa Response",
data: [
[1320105600000, 5868189.0],
[1320192000000, 1177043.0],
]
},
{
title: "Your server Request",
data: [
[1320105600000, 79.0],
[1320192000000, 20.0],
..
]
},
{
title: "Your server Response",
data: [
[1320105600000, 4604823.0],
[1320192000000, 965997.0],
..
]
}
]
}
}
Examples:
Get one site's home page (/) metrics:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567890abcdefg/sites/abcdefg1234567890abcdefg123456/optimizer
- (Object) GET '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Retrieve test list
Overview:
Retrieve all the tests of a user, the default is to return the first (per_page) tests, if the (page) is given in the url, it will return the tests in that page. per_page is up to 100, default is 10.
URL:
partners/<partner_id>/accounts/<account_id>/tests
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Filtering Parameters:
per_page |
The maximum number of tests objects that are returned for this request. Default (10) |
page |
The set of test objects that are returned. Example page=2&per_page=7. The request will return 8-14. Default (1) |
search_term |
allows you to filter the test by name. Default (null) |
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000061/tests
Responses:
[
rows: {
See the API for /partners/<partner_id>/tests/<test_id>.json
}
]
- (Object) GET '/partners/:partner_id/accounts/:account_id/tests/:test_id.?:response_type?'
Retrieve detailed information of a test
Overview:
Retrieve detailed information of a test.
URL:
partners/<partner_id>/accounts/<account_id>/tests/<test_id>
Parameters:
* test_id: the id of the account's test
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Requires Authentication:
YES
HTTP Method
GET
Examples:
curl -H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000061/tests/506297afc3666e1df8000014
- (Object) GET /partners/:partner_id.?:response_type?
Retrieve a partner's overview information
Overview:
Retrieve a partner's overview information.
URL:
partners/<partner-id>
Requires Authentication:
YES
HTTP Method
GET
Parameters:
NONE
Responses:
{
"name": "Foo, Inc.",
"email": "user@example.com",
"id": "4e2dfb5b0fcb1530e500000b"
}
Examples:
Get one partner data:
curl -H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890
- (Object) POST '/partners/:partner_id/accounts.?:response_type?'
Create an user account for the partner.
Overview:
Create an user account for the partner. The account holder will be email an auto-generated password. partners must supply the user's domain for their site that will be created when the account is create. Yottaa will automatically add the homepage as a keypage and start monitoring it for them.
If you are a reseller, there are many restrictions you need to take care of:
* HTTPS site is not supported.
* Root domain is not supported, ex: bob.com.
* The site domain name must be a CNAME record, A record is not supported.
* You must specify the plan parameter, see below.
These restrictions are only for reseller, if you are not a reseller just a partner, ignore these.
URL:
partners/<partner-id>/accounts
Requires Authentication:
YES
HTTP Method
POST
Parameters:
* email
site: the url of the user's domain.
first_name
last_name
company
plan:
(free | paid | plus_paid) - The optimizer billing plan, if you are granted as one of our resellers by Yottaa,
you must specify this parameter, and it must be set to one of these values.
phone: the phone number of the user.
ignore_ssl_check:
(true | false) - default is false, not check the ssl certification
deferred_host: (this field is only for 'addon' partner)
(true | false) - default is false, if true, will tell the system that this site host is not a real site.
deferred_creation: (this field is only for 'addon' partner)
(true | false) - default is false, if true, the welcome email will not be send, until you update email.
Responses:
{
"email": "bbuffone@gmail.com",
"user_id": "4e2dfb5b0fcb1530e500000b",
"site_id": "4e2dfb5b0fcb1530e500000c",
"host": "www.example.com",
"yottaa_cname": "1234567890abcdef.yottaa.org", # If you are one of Yottaa resellers, this will be returned.
"api_key": "1234567890abcdef1234567890abcdef",
"assessment_url": "https://apps.yottaa.com/assess/50c00c8dc3666e848c00031b",
"preview_url" : "https://apps.yottaa.com/framework/web/sites/4e2dfb5b0fcb1530e500000c/optimizer?first_time=true
}
Examples:
Create an partner account:
curl -F 'email=yobot@yottaa.com' \\
-F 'site=www.yottaa.com' \\
-H 'YOTTAA-API-KEY: 1234567890abcedfghijklmn' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts
- (Object) POST '/partners/:partner_id/accounts/:account_id/monitors.?:response_type?'
Create a monitor
Overview:
create a monitor for partner
URL:
partners/<partner_id>/accounts/<account_id>/monitors
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Body
"name": "Webpage Monitor",
"user_id": "4e2dfb5b0fcb1530e500000b",
"constants": {
url: "www.baidu.com"
protocol: "{HTTP | HTTPS"
http_headers: {[
{
name: "",
value: ""
}
]}, //DEFAULT(NULL)
auth: "bob", password: "123456"
},
"template_type": "multi-location",
"variables": {
locations: ["SFO", "DC",... ],
connectivities: [{
bandwidth_down: "", //Kbps
bandwidth_up: "", //Kbps
latency: "", //MS
drop_rate: "" //%
}, ...]
},
"timing" : {
"interval": INT (> 5) Minutes,
"policy": | PARALLEL,
"duration": INT, //if test
"run_times": INT, //if test is count
},
"type": "| WEBPAGE",
"status": "| RUNNING | SUSPENDED",
"suspended_message": "some status message for why it was suspended"
}
If the type of the monitor is equal to HTTP
{
"constants": {
http_method: {POST | GET | DELETE | PUT} //DEFAULT(GET)
http_body: "" //DEFAULT(NULL)
},
"type": "HTTP"
}
If the type of the monitor is equal to WEBPAGE
{
"constants": {
screenshots: {true | false} //DEFAULT(false)
browser_cache: {EMPTY | EMPTY_AND_FULL} //DEFAULT(EMPTY)
},
"variables": {
browsers: [{
name: "Firefox",
version: "7.0"
}]
},
"type": "WEBPAGE"
}
Requires Authentication:
YES
HTTP Method
POST
Examples:
curl -X POST \\
--data "{\"user_id\": \"4ec1c53d421aa904c800005a\", \"name\":\"chenlei\", \"template_type\":\"multi-location\", \"timing\":{\"interval\":\"14400\"}, \"variables\":{\"browsers\":[{\"name\":\"chrome\", \"version\":\"latest\"}], \"connectivities\": [{\"bandwidth_up\":\"6144\", \"drop_rate\":\"0\", \"bandwidth_down\":\"45056\", \"latency\":\"4\"}], \"locations\":[\"San Francisco\", \"Washington DC\"]}, \"type\":\"webpage\", \"constants\":{\"browser_cache\":\"EMPTY\", \"url\":\"www.google.com\", \"protocol\":\"HTTP\"}, \"status\":\"running\", \"screen_capture\":true}" \\
-H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
http://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/4f5d8d38421aa905cc000001/monitors
- (Object) POST '/partners/:partner_id/accounts/:account_id/sites.?:response_type?'
Create a new site for an account.
Overview:
Create a new site for an account.
URL:
partners/<partner-id>/accounts/<account-id>/sites
Requires Authentication:
YES
HTTP Method
POST
Parameters:
*host
Responses:
{
"site_id": "4e2dfb5b0fcb1530e500000b",
"host": "www.yottaa.com"
"user_id": "4e2dfb5b0fcb1530e500000b",
"yottaa_cname": "1234567.yottaa.org" // If partner is reseller.
}
Examples:
curl -F 'host=www.yottaa.com' \\
-H 'YOTTAA-API-KEY: 1234567890abcedfghijklmn' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/abcdefg1234567891/sites
- (Object) POST '/partners/:partner_id/accounts/:account_id/tests.?:response_type?'
Create a test
Overview:
create a test for partner
URL:
partners/<partner_id>/accounts/<account_id>/tests
Parameters:
* partner_id: the id of the partner account
* account_id: the id of the account belongs to the partner
Body
refer to create a monitor
Requires Authentication:
YES
HTTP Method
POST
Examples:
curl -X POST \\
--data "{\"user_id\": \"4ec1c53d421aa904c800005a\", \"template_type\":\"multi-location\",\"duration\":{\"policy\":\"COUNT\",\"length\":1},\"variables\":{\"browsers\":[{\"name\":\"ie\",\"version\":\"9\"}],\"connectivities\":[{\"bandwidth_up\":\"6144\",\"bandwidth_down\":\"45056\",\"drop_rate\":\"0\",\"latency\":\"4\"}],\"locations\":[\"San Francisco\",\"Washington DC\"]},\"type\":\"webpage\",\"constants\":{\"url\":\"www.baidu.com\",\"browser_cache\":\"EMPTY\",\"screenshots\":true}}" \\
-H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
https://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d42181904c8000061/tests
- (Object) PUT '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id/start.?:response_type?'
Start a monitor.
Overview:
Start a monitor
URL:
partners/<partner_id>/accounts/<account_id>/monitors/<monitor_id>/start
Requires Authentication:
YES
HTTP Method
PUT
Parameters:
NONE
Examples:
curl -X PUT \\
-H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
--data "" \\
https://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/monitors/1488858a0d746aca3d1/start
Responses:
[
{
monitor json
}
]
- (Object) PUT '/partners/:partner_id/accounts/:account_id/monitors/:monitor_id/stop.?:response_type?'
Pause a monitor.
Overview:
Pause a monitor
URL:
partners/<partner_id>/accounts/<account_id>/monitors/<monitor_id>/stop
Requires Authentication:
YES
HTTP Method
PUT
Parameters:
NONE
Examples:
curl -X PUT \\
-H "YOTTAA-API-KEY:80189f00e9b5012f981b34159e206af2" \\
--data "" \\
https://api.yottaa.com/partners/4ec1c53d421aa904c800005a/accounts/5ec1c53d421aa904c8000051/monitors/1488858a0d746aca3d1/stop
Responses:
[
{
monitor json
}
]
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/pause.?:response_type?'
Pause the optimizer for the site
Overview:
Pause the optimizer for the site. This API will be retired in next version, please the new API:
put '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/bypass.?:response_type?'
instead.
URL:
partners/<partner_id>/accounts/<account_id>/sites/<site_id>/optimizer/pause
Parameters:
* account_id: the id of the partner account
Requires Authentication:
YES
HTTP Method
PUT
Examples:
curl PUT \\
-H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/asdfgg1234567/sites/abcdefg1234567890abcdefg123456/optimizer/pause
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/resume.?:response_type?'
Resume the optimizer for the site
Overview:
Resume the optimizer for the site.
URL:
partners/<partner_id>/accounts/<account_id>/sites/<site_id>/optimizer/resume
Parameters:
* account_id: the id of the partner account
Requires Authentication:
YES
HTTP Method
PUT
Examples:
curl -X PUT \\
-H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/1234567890abcdef/sites/abcdefg1234567890abcdefg123456/optimizer/resume
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/optimizer/transparent.?:response_type?'
Transparent the optimizer for the site
Overview:
Transparent the optimizer for the site.
URL:
partners/<partner_id>/accounts/<account_id>/sites/<site_id>/optimizer/transparent
Parameters:
* account_id: the id of the partner account
Requires Authentication:
YES
HTTP Method
PUT
Examples:
curl PUT \\
-H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/asdfgg1234567/sites/abcdefg1234567890abcdefg123456/optimizer/transparent
- (Object) PUT '/partners/:partner_id/accounts/:account_id/sites/:site_id/update_host.?:response_type?'
Update site host.
Overview:
The api is only for the site that responsed from create account api
URL:
partners/<partner_id>/accounts/<account_id>/sites/<site_id>/update_host
Parameters:
* new_host: the new host of the site
ignore_ssl_check:
(true | false) - default is false, not check the ssl certification
Requires Authentication:
YES
HTTP Method
PUT
Examples:
curl -X PUT \\
-F 'new_host=www.yottaa.com'
-H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/asdfgg1234567/sites/asdff1223467/update_host
# == Responses:
{
"site_id": "4e2dfb5b0fcb1530e500000c",
"host": "www.example.com",
"yottaa_cname": "1234567890abcdef.yottaa.org", # If you are one of Yottaa resellers, this will be returned.
"assessment_url": "https://apps.yottaa.com/assess/50c00c8dc3666e848c00031b",
"preview_url" : "https://apps.yottaa.com/framework/web/sites/4e2dfb5b0fcb1530e500000c/optimizer?first_time=true
}
- (Object) PUT '/partners/:partner_id/accounts/:account_id/update_email.?:response_type?'
Update user account email for the partner.
Overview:
Update user account email for the partner.
URL:
partners/<partner_id>/accounts/<account_id>/update_email
Parameters:
* new_email: the new email of the partner account
Requires Authentication:
YES
HTTP Method
PUT
Examples:
curl -X PUT \\
-F 'new_email=newbbuffone@gmail.com'
-H 'YOTTAA-API-KEY: 1234567890abcdefg' \\
https://api.yottaa.com/partners/abcdefg1234567890/accounts/asdfgg1234567/update_email
# == Responses:
{
"email": "newbbuffone@gmail.com",
"id": "4e2dfb5b0fcb1530e500000b",
"name": "Bob (Buffone)"
}