Skip to content

Getting started using API

Warning

Flex Metal is under active development and still in closed Alpha state.

Please get in touch with the i3D.net sales team to learn more about the product state and roadmap or if you wish to be part of the closed Alpha program for Flex Metal.

What is Flex Metal

Flex Metal is a bare metal server provisioning platform that combines the efficiency and flexibility of cloud services with the performance of dedicated hardware on either hourly or monthly billing.

Compute resources can be ordered On-Demand without capacity guarantee (first come first serve basis). A committed pool can be defined as a base layer for guaranteed resources with On-Demand as additional non-guaranteed burst capacity.

General concept

The general concept is to create an Order of servers with specifying:

  • a Profile than contains : Operating System as OSid , Server Hostname and optional postInstallScript.

  • a Location (Datacenter geography) as locationId

  • an instance type (server hardware configuration) as instanceTypeId

  • an amount of servers to Order

  • a public SSH Key that have been previously uploaded

Order request body properties

Property Value type Required Description
locationId int Required Datacenter id, look up in GET /v3/flexMetal/location/
instanceTypeId int Required Flex Metal instance type, look up in GET /v3/flexMetal/location/{locationid}/instanceTypes
amount int Required Number of Flex Metal servers to order
profileId int Required Profile ID (OS, parameters, postinstall), look up in GET /v3/flexMetal/profile
sshKeyId UUid Required Manage your SSH keys via POST /v3/sshKey. The public key will be installed for the root user.
Table 1: Flex Metal Order element structure

Step 1: Get API token

The procedure is documented in API v3 Authentication

Create an API Key and don’t forget to add IP whitelisting to access the API.

API Key is to be used in HTTP Header as Key = PRIVATE-TOKEN and Value = your_api_key

Step 2: Create SSH key

POST /v3/sshKey

With Body

{
  "name": "mySSHKey",
  "publicKey": "ssh-rsa AAAAB3NzaC1....."
}

Verify that you SSH Key is well created

GET /v3/sshKey

Response: please note the uuid

[
    {
        "uuid": "a4a6e9c5-a3ba-xxxx-xxxx-7da2bbf25d61",
        "name": "mySSHKey",
        "publicKey": "ssh-rsa AAAAB3NzaC1.....",
        "createdAt": 1715004031
    }
]

Step 3: Create Profile

To create a Flex Metal server profile, you will need to know which Operating System id to use by using below endpoint:

GET /v3/operatingsystem

Look up the desired OS and note the id

For example CentOS 8.5 is id 245

{
        "id": 245,
        "name": "CentOS 8.5",
        "slug": "centos-85",
        "osGroup": 2,
        "isOdp": 1,
        "availableForFlexMetal": 1,
        "active": 1
},

Then create the Profile with Body as example with os.id 245

POST /v3/flexMetal/profile

{
  "name": "myProfileCentos",
  "os": {
    "id": 245
  },
  "postInstallScript": "#!/bin/bash\necho \"Hello world\" > /tmp/test.txt"
}

Finally verify the profile is created with GET /v3/flexMetal/profile

Response as below example, please note the Profile id (437 in that case)

[
    {
        "id": 437,
        "name": "myProfileCentos",
        "os": {
            "id": 245,
            "kernelParams": []
        },
        "postInstallScript": "echo 'TOTO' > /tmp/TOTO-test.txt"
    },
]

Step 4 : Get the Flex Metal Instance id and Location id

Step 4.1 : Get Location id

GET /v3/flexMetal/location/

Search for the desired Location, as example EU: Rotterdam is Location id is 18

{
        "id": 18,
        "name": "EU: Rotterdam",
        "shortName": "ams",
        "displayName": "EU: Rotterdam",
        "countryId": 149,
        "countryName": "Netherlands",
        "countryShortName": "NL"
},

Step 4.2 : Get Instance Type id

Using the Location id from Step 4.1

GET /v3/flexMetal/location/{locationid}/instanceTypes

For example in Rotterdam (location is 18)

Response as below, search for desired instance, as example bm7.std.8 is instance type id 129

{
        "id": 129,
        "locationId": 18,
        "name": "bm7.std.8",
        "sockets": 1,
        "cores": 8,
        "memory": 16,
        "memoryType": "std",
        "storage": 480,
        "storageType": "ssd",
        "instanceTypeGenerationId": 29,
        "generationName": "Coffee Lake",
        "pricing": [
            {
                "price": 31,
                "currencyId": 0,
                "type": "hour"
            }
        ]
},

Step 5: Create a Flex Metal order

You will need the above id to proceed to your Flex Metal order:

  • Location ID
  • Instance Type ID
  • Profile ID
  • SSHKey uuid

Step 5.1: Create order

POST /v3/flexMetal/order/

with the body below as example

{
  "locationId": 18,
  "instanceTypeId": 129,
  "amount": 1,
  "profileId": 437,
  "sshKeyUuid": "a4a6e9c5-a3ba-xxxx-xxxx-7da2bbf25d61"
}

you will get a Response as below, please note the OrderID

[
    {
        "orderId": "018f7891-c004-xxx-xxx-7300dcd04b8b"
    }
]

Step 5.2: Get order status

GET /v3/flexMetal/order/{OrderID}

Response as below example, please note the hostId (in that case 3321477)

[
    {
        "client": {
            "id": 12345,
            "name": "SampleCustomer"
        },
        "orderId": "019053a5-bdc5-734a-xxxx-3061b82dbf2e",
        "location": {
            "id": 8,
            "name": "US: Los Angeles - CA"
        },
        "amount": 1,
        "status": "inProgress",
        "servers": [
            {
                "id": 157437,
                "hostId": 3321477,
                "status": "provisioning",
                "profile": {
                    "operatingSystem": {
                        "operatingSystem": "Ubuntu",
                        "version": "22.04",
                        "kernelParams": []
                    },
                    "postScript": "#!/bin/bash echo 'TEST' > /tmp/test.txt",
                    "instanceType": {
                        "id": 129,
                        "name": "bm7.std.8"
                    },
                    "sshKey": {
                        "name": "sample-ssh",
                        "content": "redacted"
                    }
                },
                "deliveredAt": 1719390290,
                "releasedAt": null
            }
        ],
        "createdAt": 1719390289
    }
]

Step 6: Server details to connect

Use the hostID from the order details from the previous step to retrieve all specific information for each server including the IP addresses.

GET /v3/host/{hostID}

Note

You can also use GET /v3/host/summary for a less expansive list of all hosts.

Response as below example, please note the IP address which is "private": 0, to have IP to SSH into

[
    {
        "id": 3321477,
        "userId": 12345,
        "serverId": 157437,
        "serverName": "Server 202015",
        "serverType": 0,
        "projectName": "",
        "clientServerName": "",
        "clientState": "",
        "liveHostName": "server202015.dedi.i3d.net",
        "isVirtual": 0,
        "category": "Dedicated Servers",
        "osId": 261,
        "locationId": 8,
        "dcLocationId": 2,
        "instanceType": "",
        "fleetId": "0",
        "newFleetId": null,
        "fleetAssociatedSince": 0,
        "rackName": "LA3:01:002160:0409",
        "dateStart": "2024-06-26",
        "dateEnd": "2074-06-26",
        "dateCancelled": "0000-00-00",
        "dateEndContract": "0000-00-00",
        "contractPeriod": 1,
        "extendPeriod": 1,
        "cancellationPeriod": 1,
        "purchaseOrder": "",
        "paymentTerm": 30,
        "pricePerMonth": "0",
        "pricePerTbOveruse": "0",
        "currencyId": 0,
        "bandwidthBillingType": 2,
        "bandwidthContractual": 0,
        "ipAddress": [
            {
                "ipAddress": "172.26.xxx.xxxx",
                "version": 4,
                "type": 2,
                "private": 1,
                "interface": 1,
                "macAddress": "B8:CB:29:9F:FD:47",
                "rDns": "hosted-by.i3d.net.",
                "vlanId": 26,
                "gateway": "172.26.xxx.xxx",
                "netmask": "255.255.252.0",
                "prefix": 22
            },
            {
                "ipAddress": "162.244.xxx.xxxx",
                "version": 4,
                "type": 1,
                "private": 0,
                "interface": 1,
                "macAddress": "B8:CB:29:9F:FD:47",
                "rDns": "hosted-by.i3d.net.",
                "vlanId": 606,
                "gateway": "162.244.xxx.xxx",
                "netmask": "255.255.255.224",
                "prefix": 27
            }
        ],
        "brand": "Dell",
        "model": "PowerEdge R240",
        "numCpu": 1,
        "cpuInfo": "Type 0, Family 6, Model 158, Stepping 13",
        "cpuType": "Intel(R) Xeon(R) E-2278G CPU @ 3.40GHz",
        "cpuLoad": 0,
        "cpu": {
            "socket": 1,
            "cores": 8,
            "threads": 16,
            "info": "Type 0, Family 6, Model 158, Stepping 13",
            "type": "Intel(R) Xeon(R) E-2278G CPU @ 3.40GHz"
        },
        "memUsed": 0,
        "memMax": 0,
        "memFree": 0,
        "disk": [
            {
                "diskType": "ATA Disk",
                "diskMedium": "ssd",
                "model": "",
                "product": "MZ7LH960HBJR0D3",
                "diskSerial": "XXXX",
                "firmwareVersion": "HG59",
                "rotationRate": 0,
                "sectorSizeLogical": 0,
                "sectorSizePhysical": 0,
                "size": 894000000000
            }
        ],
        "memory": [
            {
                "brand": "AMD",
                "model": "9965745-028.A00G  ",
                "size": 17179869184,
                "speed": 2666,
                "ecc": 1,
                "memoryBank": 0,
                "memoryType": "DIMM DDR4 2666 MHz Synchronous, Unbuffered (Unregistered), ECC",
                "memorySlot": "A1",
                "memorySerial": "599E5824"
            },
            {
                "brand": "AMD",
                "model": "9965745-028.A00G  ",
                "size": 17179869184,
                "speed": 2666,
                "ecc": 1,
                "memoryBank": 1,
                "memoryType": "DIMM DDR4 2666 MHz Synchronous, Unbuffered (Unregistered), ECC",
                "memorySlot": "A2",
                "memorySerial": "5158882D"
            }
        ],
        "isReserve": 0,
        "labels": [],
        "serviceTag": "31XXXXX",
        "isODP": 0,
        "fmOrderId": "12345",
        "installStatus": null,
        "status": "ON",
        "trafficSum": 0,
        "uplinks": [
            {
                "uplinkId": 77001,
                "aggregate": false
            },
            {
                "uplinkId": 77002,
                "aggregate": false
            }
        ],
        "freeIncomingTraffic": false,
        "outgoingTrafficSum": 0,
        "incomingTrafficSum": 0
    }
]

Step 7: Connect to server

Note

Make sure that you listed the source IP for SSH and have sent the information to i3D.net support for whitelisting in ACL.

Using your private SSH key, log in with SSH with root username.

Step 8: Release the server

To release the server and stop the billing, you will need to refer to serverId:

POST /v3/flexMetal/release

Include the serverId to release with below Request Body as an example:

{
    "serverIds": [
        130405,130406
    ]
}