# Add Asset Tag POST https://api.trebellar.app/api/v2/assets/tags/add Content-Type: application/json Create a new asset tag Reference: https://docs.trebellar.app/api-reference/api-resources/assets/add-asset-tag ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add Asset Tag version: endpoint_assets.addAssetTag paths: /api/v2/assets/tags/add: post: operationId: add-asset-tag summary: Add Asset Tag description: Create a new asset tag tags: - - subpackage_assets parameters: - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Asset tag added successfully content: application/json: schema: $ref: '#/components/schemas/AddAssetTagResponse' '500': description: Unable to add asset tag content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/AddAssetTagRequest' components: schemas: AddAssetTagRequestAssetTagAssetTypesItems: type: string enum: - value: STRUCTURE - value: FLOOR - value: SPACE - value: DESK - value: SENSOR - value: UNKNOWN - value: SENSOR_GROUP AddAssetTagRequestAssetTag: type: object properties: id: type: string name: type: string description: type: string assetTypes: type: array items: $ref: '#/components/schemas/AddAssetTagRequestAssetTagAssetTypesItems' color: type: string icon: type: string category: type: string metadata: type: string required: - id - name - description - assetTypes AddAssetTagRequest: type: object properties: assetTag: $ref: '#/components/schemas/AddAssetTagRequestAssetTag' required: - assetTag AddAssetTagResponseDataAssetTypesItems: type: string enum: - value: STRUCTURE - value: FLOOR - value: SPACE - value: DESK - value: SENSOR - value: UNKNOWN - value: SENSOR_GROUP AddAssetTagResponseData: type: object properties: id: type: string assetTypes: type: array items: $ref: '#/components/schemas/AddAssetTagResponseDataAssetTypesItems' description: type: string color: type: string icon: type: string name: type: string category: type: string metadata: type: string required: - id - assetTypes - description - color - icon - name - category AddAssetTagResponse: type: object properties: data: $ref: '#/components/schemas/AddAssetTagResponseData' required: - data ``` ## SDK Code Examples ```typescript import { TrebellarApiClient } from "@trebellar/api-sdk"; async function main() { const client = new TrebellarApiClient({ environment: "https://api.trebellar.app", }); await client.assets.addAssetTag({ assetTag: { id: "string", name: "string", description: "string", assetTypes: [ "STRUCTURE", ], }, }); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( base_url="https://api.trebellar.app", api_key= ) client.assets.add_asset_tag( asset_tag={ "id": "string", "name": "string", "description": "string", "asset_types": [ "STRUCTURE" ] } ) ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/assets/tags/add" payload := strings.NewReader("{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-Trebellar-Api-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.trebellar.app/api/v2/assets/tags/add") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Trebellar-Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.trebellar.app/api/v2/assets/tags/add") .header("X-Trebellar-Api-Key", "") .header("Content-Type", "application/json") .body("{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}") .asString(); ``` ```php request('POST', 'https://api.trebellar.app/api/v2/assets/tags/add', [ 'body' => '{ "assetTag": { "id": "string", "name": "string", "description": "string", "assetTypes": [ "STRUCTURE" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.trebellar.app/api/v2/assets/tags/add"); var request = new RestRequest(Method.POST); request.AddHeader("X-Trebellar-Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-Trebellar-Api-Key": "", "Content-Type": "application/json" ] let parameters = ["assetTag": [ "id": "string", "name": "string", "description": "string", "assetTypes": ["STRUCTURE"] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/assets/tags/add")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```