Jump toUpdate content

Managing projects using Scaleway APIs

Reviewed on 09 June 2022Published on 25 July 2022

This page explains how to manage projects using Scaleway APIs.

Requirements:

Creating a project

You need your secret key and your Organization ID for the step below.

Open a terminal and type the following command to create a project. If you have not configured your environment in your local machine, make sure you replace $SCW_SECRET_KEY with your secret key and $SCW_DEFAULT_ORGANIZATION_ID with the ID of your Organization.

curl -XPOST https://api.scaleway.com/account/v2/projects -H 'X-Auth-Token: $SCW_SECRET_KEY' -d '{"organization_id":"$SCW_DEFAULT_ORGANIZATION_ID","name":"name-of-project"}'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"test-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:02:43.455727Z",
"description":""
}

Updating projects

You need your secret key and the ID of the project you want to update for the step below. For this use-case, we are updating the project created in the step above.

Note:

You can only update the name and description of your project.

Type the following command into your terminal to update your project:

curl -XPATCH https://api.scaleway.com/account/v2/projects/<SCW_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY' -d '{"name":"new-project", "description": "This is my updated project" }'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}

Listing all your projects

Note:
  • There is a default project in all Organizations.
  • The default project is named “default” and its project ID is the same as the Organization ID.
  • The default project can neither be updated nor deleted.

You need your secret key and your Organization ID for the step below.

Type the following command into your terminal to list your projects:

curl -XGET  https://api.scaleway.com/account/v2/projects\?organization_id\=<SCW_DEFAULT_ORGANIZATION_ID>&page=1&page_size=10&order_by=created_at_asc -H 'X-Auth-Token: $SCW_SECRET_KEY'

An output similar to the following displays:

{
"total_count":2,
"projects":[
{
"id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"name":"default",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2021-07-06T15:15:48.375181Z",
"updated_at":"2021-07-06T15:15:48.375181Z",
"description":""
},
{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}
]
}

Retrieving a specific project

You need your secret key and the ID of the project you want to get for the step below. For this use-case, we are getting the project we have updated in the updating projects step.

Type the following command to list a specific project.

curl -XGET https://api.scaleway.com/account/v2/projects/<SCW_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}

Deleting a project

You need your secret key and the ID of the project you want to delete for the step below. For this use-case, we are deleting the project we have created in the creating a project step.

  1. Type the following command to delete a project.

    curl -XDELETE https://api.scaleway.com/account/v2/projects/<YOUR_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY'
  2. Run the following command to list your projects to make sure you have deleted your project.

    curl -XGET https://api.scaleway.com/account/v2/projects\?organization_id\=<SCW_DEFAULT_ORGANIZATION_ID> -H "X-Auth-Token: $SCW_SECRET_KEY"

An output similar to the following displays, confirming that you have one project left:

{
"total_count": 1,
"projects": [
{
"id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"name":"default",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2021-07-06T15:15:48.375181Z",
"updated_at":"2021-07-06T15:15:48.375181Z",
"description":""
}
]
}