Help Center > > User Guide> FAQs> How Do I Obtain a User Token Using Postman?

How Do I Obtain a User Token Using Postman?

Updated at: Dec 10, 2018 15:23

Postman is a web page debugging and API development tool. It provides an easy-to-use user interface for you to send HTTP requests, including GET, PUT, POST, and DELETE requests. Postman also allows you to modify parameters in HTTP requests and returns response to your request.

A token is a user's access credential, which includes user identity and permission information. When you call an API to access cloud resources, a token is required for identity authentication.

Procedure

  1. Visit https://www.getpostman.com/apps to download and install Postman.

    Figure 1 Installation example
    NOTE:

    Postman requires the .NET Framework 4.5 component. If you do not have this component, click .NET Framework 4.5 to download and install it.

  2. Enter the email address, username, and password to register Postman.
  3. Edit the request URL, header, and body of the API used to obtain tokens and make an API call.

    • Request URL
      The request URL is in https://IAM region and endpoint/API URI format.
      1. Obtain the IAM region and endpoint from Regions and Endpoints.
        Figure 2 IAM regions and endpoints

      2. Obtain the API URI from Obtaining a User Token.

        For example, the request URL in the ap-southeast-1 region is https://iam.ap-southeast-1.myhwclouds.com/v3/auth/tokens.

      3. Select an API request method and enter the request URL in Postman.
        Figure 3 Request URL example

    • Request Header
      1. Obtain the request header from Obtaining a User Token.
        Figure 4 Request header parameter example

      2. Set request header parameters in Postman.

        Set key to Content-Type and value to application/json;charset=utf8.

        Figure 5 Header parameter example

    • Request Body
      1. Obtain the request body from Obtaining a User Token.
      2. Modify parameters in the example request body.
        {
          "auth": {
            "identity": {
              "methods": ["password"],
              "password": {
                "user": {
                  "name": "exampleuser: Username",
                  "password": "Examplepassword123: Password",
                  "domain": {
                    "name": "exampledomain: Account name"
                  }
                }
              }
            },
            "scope": {
              "domain": {
                "name": "exampledomain: Account name"
              }
            }
          }
        }

  4. Click Send to send the API request.

    Figure 6 API request example

  5. Obtain the token from the response body. When you call other IAM APIs, you can also use this token for authentication.

    Figure 7 Response example
    NOTE:
    • The validity period of a token is 24 hours. If you want to use a token for authentication, cache it to avoid frequently calling the IAM API.
    • If an error code, for example 401, is returned, the authentication fails. Change the password in the request body and send the request again. For details, see Obtaining a User Token.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel