Update LookupTable - m3ter Documentation
Update LookupTable
cURL
curl --request PUT \
--url https://api.m3ter.com/organizations/{orgId}/lookuptables/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"code": "<string>",
"version": 123,
"customFields": {}
}
'
Python
import requests
url = "https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}"
payload = {
"name": "<string>",
"code": "<string>",
"version": 123,
"customFields": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
JavaScript
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', code: '<string>', version: 123, customFields: {}})
};
fetch('https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}",
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([
'name' => '<string>',
'code' => '<string>',
'version' => 123,
'customFields' => [
]
]),
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;
}
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}"
payload := strings.NewReader(`{
"name": "<string>",
"code": "<string>",
"version": 123,
"customFields": {}
}`)
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))
}
Java
HttpResponse<String> response = Unirest.put("https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"version\": 123,\n \"customFields\": {}\n}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.m3ter.com/organizations/{orgId}/lookuptables/{id}")
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 \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"version\": 123,\n \"customFields\": {}\n}"
response = http.request(request)
puts response.read_body
HTTP Status Codes
| Status Code |
Description |
| 200 |
Successful response |
| 4XX |
Client error |
| 5XX |
Server error |
Request Body
| Field |
Type |
Description |
| name |
string |
Descriptive name for the Lookup Table. |
| code |
string |
Unique short code used to identify the table. |
| version |
integer<int64> |
Version number of the entity |
| customFields |
object |
User defined fields for custom data. |
Response Object
| Field |
Type |
Description |
| id |
string |
The UUID of the entity. |
| version |
integer<int64> |
The version number. |
| customFields |
object |
User defined fields for custom data. |
| name |
string |
The name of the Lookup Table. |
| code |
string |
The code of the Lookup Table. |
| dtCreated |
string<date-time> |
When the Lookup Table was created. |
| dtLastModified |
string<date-time> |
When the Lookup Table was last modified. |
| createdBy |
string |
ID of the user who created this Lookup Table. |
| lastModifiedBy |
string |
ID of the user who last modified this table. |
| activeRevision |
object |
Details of the active revision of the table. |