API Use-case: Claim value higher than last-sold price

How to use the Mohawk Automation (API) when the claim value is higher than the last-sold price of the item. 

Situation: a claim is filed where the claim value is higher than the last price the item was sold for.

Solution: A claim is filed, in the insurance internal system the policy has a claim amount or claim value, claim_value. The insurance company checks Mohawk Automation to see if the item has not been offered online for more than the claim value.

Python:

import requests

url = 'https://api.mohawkanalytics.com/classifiedads/gb/v1/license_plate'

headers = {'API-Key':'<YOUR_API_KEY>'}
params = {'license_plate':'EN18UWW'}

resp = requests.post(url,params=params, headers=headers)

# parse response and extract latest date, and price of article sold
date_price_dict = {}
for item in resp.json()['documents']:
date_price_dict.update({( item['fields']['published_estimated'],
item['fields']['price'])})

# extract latest value
latest_price_sold = date_price_dict[max(date_price_dict.keys())]
print(latest_price_sold)

# build internal test for logic
# IF latest_price_sold > claims_value THEN THROW WARNING

With the following response:

18500.0

Note: that we have data on the price the product was offered for, the actual payment price can be lower due to negotiations between selling and buying parties.