Updated on 2024-11-08 GMT+08:00

Getting Started

This section describes how to create predefined tags using APIs.

The token obtained from IAM is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequently calling the IAM API.

Involved APIs

If you use a token for authentication, you must obtain the a token and add X-Auth-Token to the request header when making an API call.

  • The IAM API used to obtain a token
  • The TMS API used to create predefined tags

Procedure

  1. Obtain the token by referring to Authentication.
  2. Send POST https://TMS endpoint/v1.0/predefine_tags/action.

    Add Content-Type and X-Auth-Token to the request header.

    Specify the following parameters in the request body:
    {  
     "action": "create", //Operation (mandatory, string)
       "tags" : [ 
                  {
                       "key": "ENV1",  //Key (mandatory, string)
                       "value": "DEV1" //Value (mandatory, string)
                    }, 
                  {
                       "key" : "ENV2",
                       "value" : "DEV2"
                   }
                  ]    
    }
    After the request is sent, the status code 204 is returned and the response body is empty.
    • The response message may be a success or a failure. This document takes the successful response as an example.
    • If the request fails, an error code and error information are returned. For details, see Error Codes.
    • For details about the elements and return values of response messages, see Creating or Deleting Predefined Tags.