Device Disable API Call

Albertus7 years ago

Good Day

Could Anyone tell me what do i do wrong:

import requests
import json

url = "http://domain.co.za:8082/api/devices/3"

headers = {'Content-type': 'application/json'}

user = 'admin'
password = 'P@ssword'

payload = json.dumps(
{
'attributes':{},
'category':'default',
'contact':'',
'disabled':True,
'geofenceIds':{},
'groupId':1,
'id':3,
'lastUpdate':'2018-05-17T19:48:17+02:00',
'model':'Huawei',
'name':	'Huawei',
'phone':'+27833108523',
'positionId': 21926,
'status':'offline',
'uniqueId':'3'
})

data = json.loads(payload)

print(data)

response = requests.put(url, auth=(user, password), headers=headers, data=data)

datax = response.json()

print(datax)

Thank You

Albertus Geyser

Albertus7 years ago

Good Day Anton

Could you give me some feedback?

Thank You
Albertus Geyser

Albertus7 years ago

Hi There all

Got it working . . .

Thank You
Albertus Geyser