Gateways - Update
  • 22 Dec 2023
  • 1 Minute to read
  • Dark
    Light

Gateways - Update

  • Dark
    Light

Article summary

Update Gateway

POST /1/gateways/{gateway_id}
Host: https://api.cogniac.io
curl -X POST https://api.cogniac.io/1/gateways/7eakrrvd \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"name" : "updated  gateway",
"description" : "Curl  script done it"
}'
import requests
import json
from pprint import pprint

url_prefix = 'https://api.cogniac.io'
api_version = "1"
gateway_id = 'gnnbjp24'
token = ''  # add your token here
headers = {'Authorization': f'Bearer {token}',
           'Content-Type': 'application/json'}
gateway_data = {
"name" : "updated gateway",
"description" : " New description"
}

url = f'{url_prefix}/{api_version}/gateways/{gateway_id}'
res = requests.post(url, json=gateway_data, headers=headers)

if res.status_code == 200:
    response_data = json.loads(res.content)
    
    pprint(response_data)
else:
    print(f"Error: {res.status_code}, {res.text}")

{
  "name": "updated gateway"
}
{
  "gateway_id": "Ajr2t45p",
	"location": "cogniac-hq",
	"poll_interval": 20,
  "name": "updated gateway",
  "description": "test gateway at cogniac",
  "created_at": 1463179215.124683,
  "modified_at": 1463179215.124683,
  "tenant_id": "rt06diepwc3i",
  "created_by": "test@cogniac.co",
  "ip_address": "127.0.0.1",
  "serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
  "mac_address" : "98975699e41a"
}


Was this article helpful?