Ventus Organization's management over API

Here we will guide you through the workflow for management of your organization in Ventus cloud using API

Required endpoints: 

  • auth.ventuscloud.eu - use it to get ID and Access tokens from basic credentials
  • api.ventuscloud.eu - use it to work with organization's resources 

Example using CURL

Get ID And Access tokens: 

curl -XGET https://auth.ventuscloud.eu/get-tokens -d '
{
"username":"username@company.domain",
"password":"password"
}'

Response example

{
"id_token":"eyJ......kRg",
"access_token":"eyJ......6Tg"
}

Export variables to reuse them in the next steps: 

export ID_TOKEN="eyJh......XIbA"
export ACCESS_TOKEN="eyJh......AsrA"
export ORGANIZATION_ID="c19......e50"
export REGION_NAME="eastern-switzerland" //must be in lower case
export PROJECT_ID="f5......45"

Organization ID can be extracted from URL in Ventus Console, e.g.:

https://console.ventuscloud.eu/organizations/c19XXXX-XXXX-XXXX-XXXX-XXXX50/projects

List All Projects

curl -XGET https://api.ventuscloud.eu/v1.0/invoke/gotham-enterprises/method/orgs/$ORGANIZATION_ID/projects \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN"

Response example

[
{
"id":"a8dxxxxxxxxxxxxxxxxxddf",
"name":"Swiss",
"region":"Eastern-Switzerland"
},
{
"id":"766xxxxxxxxxxxxxxxxxcdf",
"name":"Upper",
"region":"Upper-Austria"
},
{
"id":"17axxxxxxxxxxxxxxxxxdf9",
"name":"Vienna",
"region":"Vienna"
}
]

Create new project

curl -XPOST https://api.ventuscloud.eu/v1.0/invoke/gotham-$REGION_NAME-identity/method/$ORGANIZATION_ID/projects/PROJECT_NAME \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN"

Response example

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"PROJECT_NAME"
}

Get project by id

curl -XGET https://api.ventuscloud.eu/v1.0/invoke/gotham-$REGION_NAME-identity/method/projects/$PROJECT_ID \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN"

Response example

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"PROJECT_NAME"
}

Edit project name

curl -XPUT https://api.ventuscloud.eu/v1.0/invoke/gotham-$REGION_NAME-identity/method/$ORGANIZATION_ID/projects/$PROJECT_ID \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN" -d '{"name":"NEW_PROJECT_NAME"}'

Response example

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"NEW_PROJECT_NAME"
}

Delete Project

curl -XDELETE -I https://api.ventuscloud.eu/v1.0/invoke/gotham-$REGION_NAME-identity/method/$ORGANIZATION_ID/projects/$PROJECT_ID \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN"

Response example

HTTP/2 200

Get prices

curl -XGET https://api.ventuscloud.eu/v1.0/invoke/gotham-bank/method/prices \
-H "Authorization: Bearer $ID_TOKEN" \
-H "Access: Bearer $ACCESS_TOKEN"

Response example

[
{
"label":"Storage",
"description":"Per each 10 GiB",
"cost_eur":0.0003,
"cost_chf":0.0003
},
{
"label":"VC-1",
"description":"1 vCPU, 1 GiB memory",
"cost_eur":0.011,
"cost_chf":0.0121
},
{
"label":"VC-2",
"description":"2 vCPU, 2 GiB memory",
"cost_eur":0.022,
"cost_chf":0.0242
},
{
"label":"VC-4",
"description":"2 vCPU, 4 GiB memory",
"cost_eur":0.044,
"cost_chf":0.0484
}
.....
]

Example using Postman

Get ID And Access tokens: 

Create new Request with the next parameters:

  • Option: GET;
  • URL: https://auth.ventuscloud.eu/get-tokens;
  • Body: as a row 
{
"username":"username@company.domain",
"password":"password"
}

1-1

Click on the Send icon and in Response block you will receive:

{
"id_token":"eyJ......kRg",
"access_token":"eyJ......6Tg"
}

 

To save this tokens as variables for the reusing them in the next steps do the following:

  • go to the Environments tab as shown in the following image:
    3-1
  • select Globals if you need make this variables global accessible, or create additional environment for them;
  • enter key/value of your variables and click on the Save icon:
    5-1

List All Projects

Create new Request with the next parameters:

  • Option: GET;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-enterprises/method/orgs/ORG-ID/projects;

ORG-ID - Organization ID that was extracted from URL in Ventus Console, and saved as a variable

  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN

ID_TOKEN and ACCESS_TOKEN - tokens that were received with previous "Get ID And Access tokens" request and saved as a variables

6-1

Click on the Send icon and in Response block you will receive:

[
{
"id":"a8dxxxxxxxxxxxxxxxxxddf",
"name":"Swiss",
"region":"Eastern-Switzerland"
},
{
"id":"766xxxxxxxxxxxxxxxxxcdf",
"name":"Upper",
"region":"Upper-Austria"
},
{
"id":"17axxxxxxxxxxxxxxxxxdf9",
"name":"Vienna",
"region":"Vienna"
}
]

Create new project

Create new Request with the next parameters:

  • Option: POST;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-REGION_NAME-identity/method/ORG-ID/projects/newPROJECT;

REGION_NAME - region name that was entered in lowercase and saved as a variable;

newPROJECT - name of the new Project;

  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN

7-1

Click on the Send icon and in Response block you will receive:

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"newPROJECT"
}

Get project by id

Create new Request with the next parameters:

  • Option: GET;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-REGION_NAME-identity/method/projects/PROJECT_ID;

PROJECT_ID - ID of the desired project that was saved as a variable;

  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN

8

Click on the Send icon and in Response block you will receive:

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"PROJECT_NAME"
}

Edit project name

Create new Request with the next parameters:

  • Option: PUT;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-REGION_NAME-identity/method/ORG-ID/projects/PROJECT_ID;
  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN
  • Body: as a row 
{"name":"NEW_PROJECT_NAME"}

9

10

Click on the Send icon and in Response block you will receive:

{
"id":"efexxxxxxxxxxxxxxxxxf9b",
"name":"NEW_PROJECT_NAME"
}

Delete Project

Create new Request with the next parameters:

  • Option: DELETE;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-REGION_NAME-identity/method/ORG-ID/projects/PROJECT_ID;

PROJECT_ID - ID of the project, that you want to delete, saved as a variable

  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN

11

Click on the Send icon and the selected project will be deleted.

Get prices

Create new Request with the next parameters:

  • Option: GET;
  • URL: https://api.ventuscloud.eu/v1.0/invoke/gotham-bank/method/prices;
  • Headers
    • Authorization: Bearer ID_TOKEN
    • Access: Bearer ACCESS_TOKEN

12

Click on the Send icon and in Response block you will receive:

[
{
"label":"Storage",
"description":"Per each 10 GiB",
"cost_eur":0.0003,
"cost_chf":0.0003
},
{
"label":"VC-1",
"description":"1 vCPU, 1 GiB memory",
"cost_eur":0.011,
"cost_chf":0.0121
},
{
"label":"VC-2",
"description":"2 vCPU, 2 GiB memory",
"cost_eur":0.022,
"cost_chf":0.0242
},
{
"label":"VC-4",
"description":"2 vCPU, 4 GiB memory",
"cost_eur":0.044,
"cost_chf":0.0484
}
.....
]