Update a usage attribution type
curl --request PUT \
--url https://api.getlago.com/api/v1/usage_attribution_types/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_attribution_type": {
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": [
"team",
"team_id"
],
"role": "hierarchical",
"parent_code": "department"
}
}
'import requests
url = "https://api.getlago.com/api/v1/usage_attribution_types/{code}"
payload = { "usage_attribution_type": {
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": ["team", "team_id"],
"role": "hierarchical",
"parent_code": "department"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
usage_attribution_type: {
code: 'team',
name: 'Team',
description: 'Team that consumed the usage.',
attribution_keys: ['team', 'team_id'],
role: 'hierarchical',
parent_code: 'department'
}
})
};
fetch('https://api.getlago.com/api/v1/usage_attribution_types/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v1/usage_attribution_types/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'usage_attribution_type' => [
'code' => 'team',
'name' => 'Team',
'description' => 'Team that consumed the usage.',
'attribution_keys' => [
'team',
'team_id'
],
'role' => 'hierarchical',
'parent_code' => 'department'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/usage_attribution_types/{code}"
payload := strings.NewReader("{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.getlago.com/api/v1/usage_attribution_types/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/usage_attribution_types/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}"
response = http.request(request)
puts response.read_body{
"usage_attribution_type": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": [
"team",
"team_id"
],
"role": "hierarchical",
"lago_parent_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"parent_code": "department",
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z"
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Governance
Update a governance entity
This endpoint updates a governance entity. Once usage is attributed to it, only its name, description and attribution keys can change.
PUT
/
usage_attribution_types
/
{code}
Update a usage attribution type
curl --request PUT \
--url https://api.getlago.com/api/v1/usage_attribution_types/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_attribution_type": {
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": [
"team",
"team_id"
],
"role": "hierarchical",
"parent_code": "department"
}
}
'import requests
url = "https://api.getlago.com/api/v1/usage_attribution_types/{code}"
payload = { "usage_attribution_type": {
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": ["team", "team_id"],
"role": "hierarchical",
"parent_code": "department"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
usage_attribution_type: {
code: 'team',
name: 'Team',
description: 'Team that consumed the usage.',
attribution_keys: ['team', 'team_id'],
role: 'hierarchical',
parent_code: 'department'
}
})
};
fetch('https://api.getlago.com/api/v1/usage_attribution_types/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v1/usage_attribution_types/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'usage_attribution_type' => [
'code' => 'team',
'name' => 'Team',
'description' => 'Team that consumed the usage.',
'attribution_keys' => [
'team',
'team_id'
],
'role' => 'hierarchical',
'parent_code' => 'department'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/usage_attribution_types/{code}"
payload := strings.NewReader("{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.getlago.com/api/v1/usage_attribution_types/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/usage_attribution_types/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usage_attribution_type\": {\n \"code\": \"team\",\n \"name\": \"Team\",\n \"description\": \"Team that consumed the usage.\",\n \"attribution_keys\": [\n \"team\",\n \"team_id\"\n ],\n \"role\": \"hierarchical\",\n \"parent_code\": \"department\"\n }\n}"
response = http.request(request)
puts response.read_body{
"usage_attribution_type": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "team",
"name": "Team",
"description": "Team that consumed the usage.",
"attribution_keys": [
"team",
"team_id"
],
"role": "hierarchical",
"lago_parent_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"parent_code": "department",
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z"
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Authorizations
Body
application/json
Usage attribution type payload