@app.route('/get-data') # Instructions for when the javascript calls this to start the API request process
def get_data():
headers = {"authtoken":"XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "Content-Type":"text/html"} # Auth Token as a key value pair
# This requests the first 200 jobs orderd by most recent and returns any with status Collection or Leadership. 200 should be enough but can be increased if needed.
input_data = '''{
"list_info": {
"start_index": 1,
"row_count": 200,
"sort_field": "id",
"sort_order": "asc",
"search_criteria": [
{
"field": "status.name",
"condition": "is",
"values": [
"Collection",
"Approval"
],
"logical_operator": "or"
}
]
}
}'''
params = {'input_data': input_data} # Turn this into a key value pair
response = requests.get(url, headers=headers, params=params) # Send the request and save the response to a variable
return response.text # Return the response as a plain text to the calling function
@app.route('/get-approval/<jobid>') # Instructions for when the javascript calls this to get approval status
def get_approval(jobid):
headers = {"authtoken":"XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "Content-Type":"text/html"} # Auth Token as a key value pair
response = requests.get(url,headers=headers,verify=False)
return response.text