Postman#

Importing the Energy API Collection into Postman#

To import the Energy API collection into Postman, follow these steps:

  1. Copy the link to the collection: <https://energy-api.stormgeo.com/swagger/v1/swagger.json>.

  2. In the Postman app, click the “Import” button in the top left corner.

  3. Click the “Link” tab and paste the link into the “Enter a URL” field.

  4. Click “Import” to import the collection into Postman.

After importing the collection, create a new environment and add the following variable: - baseUrl: https://energy-api.stormgeo.com

Environment

Set the base URL for the requests in the collection. Select the environment you created from the top right dropdown menu in Postman.

Now that you have imported the collection and set up the environment, you need to set up authentication to make requests to the API.

Authentication#

Navigate to the /api/v1/auth endpoint and provide your Nena portal credentials. To set up a script that gets the token and sets it in the environment, follow these steps:

  1. Click the “Scripts” tab on the auth endpoint and add the following script:

    var jsonData = pm.response.json();
    pm.environment.set("bearerToken", jsonData);
    
    Auth Script

This script will set the token in the environment when you make the auth request.

  1. To make the auth request, click the “Body” tab and add the following to the body:

    {
        "username": "your_username",
        "password": "your_password"
    }
    
  2. Click “Send” and the response will include the bearer token. The bearerToken variable will be set in the environment. The token variable will automatically update when you make a request to the auth endpoint.

Important

The access token is valid for 60 minutes from the time you submit a login request.

Every endpoint in the collection is already set up to use the bearer token in the environment.

Now you are ready to start making requests to the API.