AVX::REST and AVX::JSON 
| URL | Endpoint URL to hit the REST |
|---|---|
| Request_type | “GET”, “PUT”, “POST” or “DELETE” |
| Header_json |
AVX::JSON(json_data,seq_no=0,properties={‘sleep’:0,’wait’:0}) Json_data is the json value to be passed to REST |
| request_entity_json | AVX::JSON(json_data,seq_no=0,properties={‘sleep’:0,’wait’:0}) |
| response_type?required_param | Path_of_the_param is the query and other params which can be provided as string itself |
To pass variables when using AVX::REST:
- Execute REST call.
-
Store the value called “Signature”.
auth_url = "https://{}/axapi/v3/auth".format(deviceip) headerjson_auth = {"Content-Type": "application/json"} bodyjson_auth = {"credentials": {"username": username ,"password": '@$avx_password@$' }} AVX::REST(dev_name,auth_url,'POST',json.dumps(headerjson_auth),json.dumps(bodyjson_auth),'json?sig=authresponse/signature'){ "authresponse" : { "signature":"6181d42578cc03dd1088d58884637e", "description":"the signature should be set in Authorization header for following request." } }The value is stored in ’json?sig=authresponse/signature’. In the above, json signature lies under authresponse, hence the response_type?required_param will be json?sig=authresponse/signature.
-
The variable signature (sig) is reused in the following REST call’s
header.
url = 'https://{}/axapi/v3/slb/service-group/{}'.format(deviceip,value) headerjson = {"Authorization": "A10 $$sig$$", "Content-Type": "application/json"} bodyjson = {"service-group": { "member-list": state_pool_dict[value] }} AVX::REST(dev_name,url,'POST',json.dumps(headerjson),json.dumps(bodyjson))
