Each command corresponds to a single API HTTP GET or POST, with the URL corresponding to the command line arguments.
1. Set your API endpoint
Use api-jhb2.go2cloud.co.za if your account is in JHB2. Both lines below can be copied straight from your profile page under API Tools.
export G2CURI=https://api-jhb1.go2cloud.co.za2. Set your credentials
export G2CAUTH=<account-uuid>:<api-key>3. Create a drive and upload your image
The upload tool creates the drive for you, sized to your image, and uploads it in chunks:
$ ./go2cloud-upload.sh image.raw
Endpoint : api-jhb1.go2cloud.co.za
Account : bfa3e0f3-804b-4943-948a-844034c5146a
Operation : upload to drive
Destination : new drive, name image.raw, tier disk
Source : image.raw
Size : 20.0 GiB (21474836480 bytes)
Resume from : 0 B
Transfer : 5120 chunks of 4.0 MiB
Proceed with upload to api-jhb1.go2cloud.co.za? [y/N] y
Created drive 08c92dd5-70a0-4f51-83d2-835919d254df of size 21474836480
[########################] 100.0% 20.0 GiB / 20.0 GiB 112.4 MiB/s ETA 00:00:00
Upload completed: 20.0 GiB in 00:30:22 (average 112.4 MiB/s)The same thing with the raw API, for reference:
$ ./go2cloud.sh -c drives create << EOF | grep drive
> name TestDrive
> size 21474836480
> EOF
drive 08c92dd5-70a0-4f51-83d2-835919d254df
$ ./go2cloud.sh -f image.raw drives 08c92dd5-70a0-4f51-83d2-835919d254df write4. Boot a server from the drive
With 2000 core MHz and 1024 MB of RAM:
$ ./go2cloud.sh -c servers create << EOF
> name TestServer
> cpu 2000
> mem 1024
> ide:0:0 08c92dd5-70a0-4f51-83d2-835919d254df
> boot ide:0:0
> nic:0:model e1000
> nic:0:dhcp auto
> smp auto
> vnc auto
> password XXXXXXXX
> EOF
server 85ef58c8-6f5d-4f7f-8f1c-0c19d45d7c1c
name TestServer
cpu 2000
smp auto
smp:cores 1
smp:sockets 1
mem 1024
ide:0:0 08c92dd5-70a0-4f51-83d2-835919d254df
boot ide:0:0
nic:0:dhcp auto
nic:0:model e1000
rx 0
tx 0
vnc auto
password XXXXXXXX5. Getting a drive back out
To download a drive, shut its server down first, then:
$ ./go2cloud-download.shRun with no arguments and it lists your drives so you can choose one, or name the drive and file directly:
$ ./go2cloud-download.sh 08c92dd5-70a0-4f51-83d2-835919d254df myserver.imgYou can use any HTTP client to interact with the API, including curl, Python's requests library, or tools like Postman. The API follows standard REST conventions, so the same patterns apply to all resource types:
List resources: GET /resource-type/list/
Get details: GET /resource-type/uuid/
Create: POST /resource-type/create/
Modify: POST /resource-type/uuid/set/
Delete: POST /resource-type/uuid/destroy/