RUT241 - How to upload OpenVPN Config via API

Hello,

I’am trying to upload my OVPN config via the api. I have this python code to do the job:

def upload_vpn_config(file_path):
    url=f"https://{ip}/api/openvpn/config/ovpniot5"
    headers={"Authorization": f"Bearer {token}"}
    with open(file_path, 'rb') as file:
        files = {"option": "config"}
        files["file"]= file
        response = requests.post(url, headers=headers, files=files, verify=False)
        print(response.text)

I get a 200 as response and:

{"success":true,"data":{"path":"\/etc\/vuci-uploads\/cbid.openvpn.ovpniot5.configvpnclient.conf"}}

But the config never shows up in the GUI.
Any tips would be highly appreciated.
Thank you

Hi there,

I’ve submitted a question regarding this on our internal system. I’ll keep you up to date once I have an answer.

Regards,
M.

Hi again,

I’ve got an answer in regards to pushing the configuration - do you update the configuration by running the command
PUT openvpn/config/ovpniot5
An example here: https://developers.teltonika-networks.com/reference/rutx50/7.13.1/v1.5/openvpn#put-openvpn-config

You may also find additional examples in case you’ll need anything else in the developers portal: https://developers.teltonika-networks.com/examples

Regards,
M.