Hometutorials
postman api

Jump toUpdate content

Using Scaleway APIs with Postman

Reviewed on 24 March 2022Published on 24 March 2022
  • postman
  • postman-api
  • scaleway-api
  • postman-download
  • request
  • json

Postman is an API client that allows you to build, test and manage APIs through a graphical interface. The platform includes features that make it easy for you to:

  • create, import and test APIs
  • work collaboratively with other users
  • create different environments with unique variables
  • display responses in several programming languages
  • configure granular request authorization rules, using different authorization types
  • capture and monitor request data (status, time, size)

In this tutorial you will learn how to import Scaleway APIs into Postman, configure your environment variables and authentication and share your workspace with other users.

Requirements:

Importing Scaleway APIs into Postman

  1. Click Workspaces > Create Workspace in the top menu of the Postman interface.

  2. Enter a name and description and select a visibility setting for your workspace. Your workspace displays.

  3. Go to the Scaleway developers website and select a product API to download.

    In this tutorial, we use the Scaleway Instances API.

  4. Click Download OpenAPI.

  5. Click Collections > Import in the side menu of the Postman interface.

  6. Drag and drop the Instances Open API yml file into into the indicated space to upload.

  7. Click Import to conclude.

    The Instances API displays under the Collections tab in the side menu. The API is organized into files, following the different request categories (including servers, images, placement groups, IPs).

Setting up an environment

Postman environments are sets of key/value pairs. They are spaces in which you can store your authentication information to use as variables with your collections.

In this section, we show you how to create an environment with environment variables for a Scaleway project.

  1. Click Create Environment.

  2. Enter a name for your environment.

  3. Configure your variables, as such:

    • VARIABLE - enter the key for your variable.
    • TYPE - select between default, which will be visible in plaintext, and secret, will mask the values on the screen.
    • INTIAL VALUE - this is the value shown to other users when you share the variable in a collection, environment or globals.
    • CURRENT VALUE - this is the value used when you send a request.

    You can add your project ID, and the access key and secret key for your project. We recommend you set your project’s secret key as secret to increase security.

  4. Click Save to do so.

Setting up authorization

You can set up authorization at the collection, request category and/or request level. In this tutorial, we will set the authorization at the collection level and configure the requests to inherit the setting from parent.

  1. Go to the Collections tab.

  2. Click on the Instance API collection. The Authorization tab displays by default.

  3. Select your environment in the top right menu.

  4. Select API Key as the authorization type.

  5. Enter the following values:

    • Key: X-Auth-Token
    • Value: {{SCW_SECRET_KEY}} - this is the variable you set up in your environment.
    • Add to: Header
  6. Click Save.

  7. Go to your request of choice.

  8. Click the Authorization tab.

  9. Select Inherit auth from parent as the authorization type.

Running a request

In this tutorial, we will create an Instance through an API request operated with Postman.

  1. Go to the Collections tab of the Postman interface.

  2. Click the Create a server request under Instance API > /instance/v1/zones/{zone}/servers/.

  3. Go to the Body tab of the request.

  4. Edit the {zone} variable in the endpoint. In this tutorial we will create our Instance in fr-par-1.

    Tip:

    If you always create resources in the same region, you can set up a variable for the zone in your environment.

  5. Edit the parameters in the request with your preferences following the example below. In this tutorial we will create a GP1-M instance with the default local volume.

    Note:
    {
    "name": "my-new-instance",
    "commercial_type": "DEV1-S",
    "image": "881d7a33-4cfa-4046-b5cf-c33cb9c62fb6",
    "enable_ipv6": false,
    "boot_type": "local",
    "project": "697ef834-9bd0-4181-ae29-b0bcd0e574ae"
    }
  6. Click Send.

You can Save to make sure your configuration is stored for future use.

Going further

Postman also has a Command Line Interface (CLI) called newman that you can use to run your collections. Find out more about newman in the README.

For more information about how to use Postman features, refer to the Postman learning center.