Hello all, using the following Python code to add a device to Teamviewer, this is
{'error': 'invalid_token', 'error_description': 'Access token does not have the required permissions for this function.', 'error_code': 2}
How do I resolve this?
Thanks
import requests
from requests.auth import HTTPDigestAuth
import json
from pandas.io.json import json_normalize
def createNewDevice():
remoteID = input("Enter Remote ID:")
groupID = input("Enter Group ID:")
descr = input("Enter Description;")
alias = input("Enter Alias:")
pword = input("Enter Password:")
#Go by Usernam
url="https://webapi.teamviewer.com/api/v1/devices"
#oAuth2 syntax for Bearer Token appears to be correct....
headers = {"content-type": "application/json", "Authorization": "Bearer xxxxxx-xxxxxxxxxxx"}
#need data
data = {"remotecontrol_id": remoteID, "groupid" : groupID, "description" : descr, "alias" : alias, "password" : pword}
r = requests.post(url, headers=headers,json=data)
print("Done")
createNewDevice()