So you can probably achieve something with a custom response handler.
You will have specified your initial POST payload in your setup config.
Then you can define a custom response handler ie: PostDateHandler , that will update the date values upon each response.
The updated POST payload will also get automatically persisted back to your inputs.conf stanza to survive restarts.
This custom response handler is a class you add to rest_ta/bin/responsehandlers.py
Examples to guide you below.
class PostDateHandler:
def __init__(self,**args):
pass
def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
#PSEUDO CODE ONLY TO GUIDE YOU , ADJUST AS NECESSARY
#index HTTP response
print_xml_stream(raw_response_output)
#get POST data
if not "data" in req_args:
post_data = {}
else:
post_data = json.loads(req_args["data"])
#set new date to something
new_from_date = "2018-09-05 00:00:00"
new_to_date = "2018-10-05 00:00:00"
post_data["fromDate"] = new_from_date
post_data["toDate"] = new_to_date
#update POST data
req_args["data"] = json.dumps(post_data)
... View more