Admin API Reference

The Admin API is for managing Compress API keys and Easy IO CDN sites. The hostname is optimize.exactlywww.com and must be accessed by HTTPS. All requests to the API must use the POST method and include a user-agent. All responses will be JSON-encoded (unless noted otherwise?).

2022-03-05: Note that this is newly documented, and has been under some heavy change recently. Thus the data returned may change without notice.

Authentication

To use the API, you must provide an API key. Sub-keys naturally cannot create other sub-keys, but may be used to create CDN sites/zones. The POST parameters key and token are used for Easy IO CDN management (both must be set to a valid API key), while Compress API management simply uses the api_key parameter (for CDN only?).

Easy IO Show Sites – /exactdn/show.php

To display detail about existing CDN sites on your account, use  https://optimize.exactlywww.com/exactdn/show.php

The response will look something like this:

array (
	'live_sites' => 1,
	'sites'      => array(
		[0] => array(
			'site_id' => '17',
			'zone' => 'earqb5e5seg',
			'alias' => 'earqb5e5seg.exactdn.com',
			'site_url' => 'https://www.example.net/',
			'location' => 'NA,US',
			'pending' => false,
			'live' => '1',
			'purgeable' => '1',
			'bandwidth' => '3935162323',
			'beforet' => 'https://gtmetrix.com/reports/www.example.net/Wsv1hIOf/',
			'aftert' => 'https://gtmetrix.com/reports/www.example.net/jgeylNvw/',

		),
	),
	'licensed' => '10',
	'interval' => 'month',
	'quota' => 2000000000000,
)<br>

Which gives some detail about account limits, and then an array of sites with relevant details:

  • live_sites - The number of sites that count toward the account quota, any sites where live = 0 do not affect the site limits.
  • licensed - The number of sites an account may have. Sub-keys may have their own limits and default to 0 (no limit).
  • interval - The renewal interval: month, year, or life. Sub-keys will not show the interval.
  • quota - The amount of bandwidth allowed for the account in bytes.
  • sites - An array of sites with the following detail:
    • site_id - The unique identifier for a given Easy IO site.
    • zone - The backend CDN zone name. Will match the alias unless a custom hostname/alias is applied.
    • alias - The CDN hostname for the site/zone.
    • site_url - The origin URL for the CDN zone.
    • location - The detected geographic location of the origin server. This affects whether images are processed via the North America, Europe, or Oceania server location.
    • pending - For new sites, this will be true. Sites that are pending cannot be removed.
    • live - Whether a given site is live/production or dev/staging. If a given site is not detected correctly, contact support.
    • purgeable - 1 = site cache may be purged, 0 = no purging allowed. Normally set to 1 except in extreme cases.
    • bandwidth - The amount of bandwidth a site has consumed in the last 30 days, in bytes.
    • beforet - The URL of the site performance test, run when a site was first added to the account.
    • aftert - The URL of the performance test, run after Easy IO is activated on a given site.

Try it out with cURL (replacing ‘abc123’ with your own key):

curl --data key=abc123 --data token=abc123 https://optimize.exactlywww.com/exactdn/show.php

Easy IO Add/Create Site – /exactdn/create.php

To add a site to your account, submit a request with your API key and the origin URL. Requests are sent to  https://optimize.exactlywww.com/exactdn/create.php

Here is an example with cURL:

curl --data key=abc123 --data token=abc123 --data site_url='https://www.example.com/' https://optimize.exactlywww.com/exactdn/create.php

The response is JSON-encoded with the following data:

  • id - The unique identifier for the new site.
  • site_url - The origin URL, which should match what was provided, though trailing slashes will be added if missing.
  • dev - 1/0: a value of 1 means the site is assumed to be a development/staging site and will not count against the site limit.
  • alias - The CDN hostname generated for this site.
  • status - Will always be 'success'.

If there is an error, the response will be an array with a single 'error' item that includes an error message:

array(
	'error' => 'site URL not provided'
)

Easy IO Remove Site – /exactdn/remove.php

To remove a site, submit a request with your API key and the site ID. Use the /exactdn/show.php endpoint to retrieve a given site ID. Requests should be sent to https://optimize.exactlywww.com/exactdn/remove.php

Here is an example with cURL:

curl --data key=abc123 --data token=abc123 --data site_id=18 https://optimize.exactlywww.com/exactdn/remove.php

Errors will be given in exactly the same form as Site Create requests, but a success will look like this:

array(
	'success' => true
)

Compress API Key Add/Create

Compress API Add/Create (Sub)Key – /api_key/create.php

To add a sub-key to your account, submit a request with your API key. Requests should be sent to  https://optimize.exactlywww.com/api_key/create.php

Here is an example with cURL:

curl --data api_key=abc123 https://optimize.exactlywww.com/api_key/create.php

success will look like this:

array(
	'success' => 1,
	'sub_key' => 'xyz456',
)

Whereas an error will be shown like this:

array(
	'error' => 'API key not found'
)

Compress API Remove (Sub)Key – /api_key/remove.php

To remove a sub-key from your account, submit a request with your API key and the sub-key. Requests should be sent to https://optimize.exactlywww.com/api_key/remove.php

Here is an example with cURL:

curl --data api_key=abc123 --data sub_key=xyz456 https://optimize.exactlywww.com/api_key/remove.php

success will look like this:

array(
	'success' => 1,
	'sub_key' => 'xyz456',
)

Errors will be returned in the same format as above for a /create.php request.

More API endpoints available

There are additional endpoints that need documentation. We'll be adding more documentation in the future, but if you're looking for something that isn't listed already, just ask and we'll prioritize it!

Have an idea, or need help?

If you have any questions, suggestions, or ideas about the API, feel free to contact us.

Still need help? Contact Us Contact Us