Tried various ways with trying to call the api endpoint direct as well as Axios but I cannot update an Aflex rule programatically. I always get a JSON error ({“code”: 1174, “msg”: “Invalid JSON document.”}}), c:/temp/1.file below is a basic iRule for which I’ve tried to save also in various encodings, ASCII, UTF-8 etc:
####BEGIN Python implementation### import acos_client as acos c = acos.Client(‘server’, acos.AXAPI_21, ‘adminuser’, ‘adminpass’) c.slb.aflex.upload(name=“C:/temp/1.file”,aflex=“pycreatedAflex”) ####END Python implementation###
#Raw HTTP# HTTP Request { POST https://lbname/services/rest/v2.1/?format=json&method=slb.aflex.upload&session_id=<hex_id_removedforpost>HTTP/1.1 Host: lbname User-Agent: ACOS-Client-AGENT-1.4.3 Accept-Encoding: gzip, deflate Accept: / Connection: keep-alive Content-type: application/json Content-Length: 180
------------AaB03x Content-Disposition: form-data; name=“upload_aflex”; filename=“C:/temp/1.file” Content-Type: application/octet-stream
pycreatedAflex ------------AaB03x-- }
{“response”: {“status”: “fail”, “err”: {“code”: 1174, “msg”: “Invalid JSON document.”}}}