import requests import json import sys def NewFWQuery(RestMethod, Query, Arguments, Data): headers = {'Authorization' : 'Bearer {fffffffffffffffffffffff=}'} URL = "https://qlf-filewave-master.dbs.fr" + Query + Arguments if RestMethod == "GET": response = requests.get(url=URL, headers=headers) elif (RestMethod == "POST") and not (bool(Data)): response = requests.post(url=URL, headers=headers) elif (RestMethod == "POST") and (bool(Data)): response = requests.post(url=URL, headers=headers, data=Data) else: return if not response.ok: print("Request went wrong\n", response.status_code) return response name = "Johny" comment = "so cash" parentID = 0 dataSet = {"name": name, "comment": comment, "parentID": parentID} #json = json.dumps(dataSet) #print(json) NewFWQuery("POST", "/filewave/api/devices/v1/groups", "", dataSet) #newclient json #{"items":[{"device_name":name,"serial":serial}],"actions":[{"params":{"group":ID},"name":"import_or_move_to_group"}]}