I’m doing it using python, but using “file” as the name of the variable, and uploading a openvpn conf file as attachment worked for me.

#Upload the config file.
files = {'file': open('config.ovpn','rb')}
req = s.post(base_url + 'api/ovpn/client/upload', files=files, headers=headers, cookies=cookies)
cookies = dict(req.cookies)
data = json.loads(req.content)
if not data['code'] == 0:
    print("Error uploading file")
    exit(1)

After successfully upload the file, you should call api/ovpn/client/uploadcheck, api/ovpn/client/addnew and api/ovpn/client/set

2 Likes