This article will get you up and running with the API as quickly as possible. The Cachoid API allows you to perform a VCL upload and download, cache purge, cache enable or disable, and TLS certificate upload, and more. Without further ado let’s dive in head on!

First Things First!

Head out to your Profile page at Warp ( https://warp.cachoid.com/ ) and make sure your API key is generated by clicking on the Generate API Key button. This action will generate your API key, which you can use in your API calls to authenticate with our API endpoint. Click on the Show / Hide API Key button to copy/paste the API key and carry on with the snippets.

NB: The example below use the variable $API_KEY to imply that your API key is saved in the shell environment variable API_KEY (export API_KEY=api_key_string).

VCL Push

You can push a new VCL and make it load immediately and on the fly. The VCL upload script at Github is small wrapper around cURL tool. Here’s a snippet:

Query:

curl -F file=@my.vcl -XPOST -vvv -H “Accept: application/vnd.cachoid.v1+json” -H “Authorization: Bearer $API_KEY” http://api.cachoid.com/vcl/upload/cachoid.com

Response:

HTTP/1.1 201 Created

my.vcl here is an actual file containing the VCL you want to push live.

Is the Cache Enabled?

You can query the API on whether a Cachoid has caching enabled like this:

Query:

curl -XGET -vvv -H “Accept: application/vnd.cachoid.v1+json” -H ‘Authorization: bearer $API_KEY’ https://api.cachoid.com/cache/status/cachoid.com

JSON Response:

{“status”:”enabled”}

NB: It’s expected that the domain name, cachoid.com in this case, is URL-encoded. It goes the same for the Subpage

You can reuse our script from Github to test the API and build upon it to create your own scripts should you need it:

https://raw.githubusercontent.com/cachoid/scripts/master/curl_api.sh

TLS/SSL Upload

This API endpoint allows you to upload a TLS/SSL certificate live to your cachoid. This is convenient if you’re needing to auto update your certificate (ex: Let’s Encrypt).

Query

curl -F crt=@domain.crt -F key=@domain.key -XPOST -vvv -H “Authorization: Bearer $API_KEY” https://api.cachoid.com/tls/upload/domain.tld

Response:

HTTP/1.1 201 Created

Where domain.crt contains your SSL certificate (and bundle if any), domain.key is your certificate’s private key, and domain.tld is the domain name just like you have created it on Warp (the control panel).

Cache Purge

TODO

Cachoid Hosted

This API endpoint converts your cachoid to a cachoid-hosted website and pushes your uploaded files live.

Query

curl -F zip=@$zip_file -XPOST -vvv -H “Authorization: Bearer $API_KEY” https://api.cachoid.com/hosting/files/upload/domain.tld

Response:

HTTP/1.1 201 Created

$zip_file is the zip file that contains the HTML, CSS, JS, and media files you wish to publish live.