Table of Contents
- Prerequisite before starting
- Authentication prerequisite
- Get all zones
- Create Virtual Network
- Create Security Group
- Create Volume
- Create Server Group
- Create Key Pair
- Create Virtual Machine
- Error handling
Prerequisite before starting
- For this "Getting started", we will use the command-line tool Curl.
- The API requires the generation of an API key.
- Your Orange Business Services representative will provide you this API key and your project id (
{{project_id}}
in requests) - The API key must be added to HTTP headers of each API call.
- The header is
X-API-Key
.
Authentication prerequisite
Access to this API is secured by the OAuth 2.0 framework with the Client Credentials grant type, which means that you will have to present an OAuth 2.0 access_token
whenever you want to request this API.
It's easy to negotiate this access_token
: just send a request to the proper token negotiation endpoint, with a Basic Authentication header valued with your own client_id
and client_secret
.
For this API, the token negotiation endpoint is:
https://api.orange.com/oauth/v3/token
A technical guide is available to learn how to negotiate and manage these access_token
.
Get all zones
List all zones without filter, sort or paging
Request
- Method & URL :
GET
,https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones?region=EUR
- Authorization : OAuth 2.0 authentication to get the access token (see "Prerequisite before starting" section)
- Header : add
X-API-Key
=> Value provided by your administrator
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones?region=EUR
Response
Header
you will receive 3 specific headers:
HTTP/1.1 200 OK
for a successful answerX-Result-Count
, the number of ZonesX-Total-Count
, the number of all Zones matching criteria.
HTTP/1.1 200 OK
X-Result-Count: 15
X-Total-Count: 15
Body
List of zones in a json format
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
[{
"city": "Stockholm",
"countryCode": "SE",
"name": "Stockholm-1",
"region": "EUR"
},
{
…
]
Create Virtual Network
This operation allows partners to create a new virtual network for the concerned project and zone respectively based on their identifier and name.
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/virtualnetworks
-d "{
"name": "pca-virtual-network-01",
"description": "pca-virtual-network-01",
"subnets":
[
{
"subnet": "x.x.x.x/xx",
"enableDhcp": false,
"allocateIpAddressFromStart": true,
"dnsPrimary": "x.x.x.x x.x.x.x",
"dnsSecondary": "x.x.x.x x.x.x.x",
"gatewayIpAddress": "x.x.x.x",
"serviceIpAddress": "x.x.x.x"
}
]
}"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx"
}
Create Security Group
This operation allows to create a security group for the concerned project and zone respectively based on their identifier and name.
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/securitygroups
-d "{
"name":"securityGroup1",
"description":"Security Group 1",
"securityRules": [{
"name": "Rule1",
"description": "MyRule1",
"matchRemoteIpSubnets": ["x.x.10.0/24","x.x.11.0/24"],
"matchDirections": ["ingress"],
"matchProtocols": ["dccp"],
"matchPortRanges": ["xxxx-yyyyy"]
}]
}"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx"
}
Create Volume
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/volumes
-d "
{
"name":"volumeTest1",
"description":"Volume Test1",
"tags": {},
"size": 100
}
"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx"
}
Create Server Group
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/servergroups
-d "
{
"name":"Test1",
"description":"Server group Test1",
"policy": "affinity"
}
"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx"
}
Create Key Pair
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/keypairs
-d "
{
"name": "keypair1",
"description": "Key Pair Test1",
"publicKey": "-----BEGIN PUBLIC KEY-----XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-----END PUBLIC KEY-----"
}"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx",
"publicKey": "xxxxxxxx",
"privateKey": "xxxxxxx"
}
Create Virtual Machine
Request
curl -X POST \
-H "Authorization: {access_token}" \
-H "X-API-Key: {dev_key}" \
https://api.orange.com/evolutionplatform/iaas/sandbox/v1/projects/{{project_id}}/zones/Stockholm-1/virtualmachines
-d "
{
"name": "hostname1",
"description": "Description1",
"image": "image1",
"flavor": "flavor1",
"volumeRefs": [{
"name": "vol1"
}],
"interfaces": [{
"name": "interface1",
"virtualNetworkRef": {
"name": "vn1"
},
"ipAddresses": ["XX.XX.XX.1"],
"floatingIpAddresses": ["YY.YY.YY.1"],
"securityGroupRefs": [{
"name": "secuGrp"
}],
"allowedIpAddressPairs": [{
"ipAddress": "1.2.3.4",
"mode": "active-active",
"macAddress": "macAddressAddrPair"
}
],
"macAddress": "macAddressIntf",
"dhcpOptions": [{
"code": "dhcpOptOption1",
"value": "dhcpOptValue1"
}, {
"code": "dhcpOptOption2",
"value": "dhcpOptValue2"
}
],
"isIpLocal": false,
"interfaceRoutes": [{
"prefix": "prefix1",
"communityTags": ["community1"]
}, {
"prefix": "prefix2",
"communityTags": ["community2"]
}
]
}, {
"name": "interface2",
"virtualNetworkRef": {
"name": "vn2"
},
"ipAddresses": ["XXX.XXX.XXX.0"],
"floatingIpAddresses": ["XXX.XXX.XXX.0"],
"securityGroupRefs": [{
"name": "secuGrp"
}],
"allowedIpAddressPairs": [],
"macAddress": "macAddress2",
"dhcpOptions": [],
"isIpLocal": true,
"interfaceRoutes": []
}
],
"keyPairRef": {
"name": "keypair"
},
"userData": "userdata",
"metaData": {"name":"metadata"},
"serverGroupRef": {"name": "serverGroup"},
"configurationDrive": false
}
"
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"id": "xxxxxxxx",
"hRef": "xxxxxxx"
}
Error handling
Orange APIs use appropriate HTTP status codes to indicate any request processing error. For more details, see Handling API errors.