API Use-case: Travel insurance claim validation

How to use the Mohawk Automation (API) to validate a travel insurance claims' validity, based on wether the claimant has tried to sell it before.

Travel insurance claim validation

Situation: A luxury item is claimed by someone to be lost during their vacation, however the insurance company would like to verify that the item hasn’t been solved in the recent past.

Solution: Check that the claimant, claimant, has not previously offered the product for which the claim is made online. Also make sure that the results only return items above a certain price (so that, in the case of an iPhone not the iPhone cases for that model are returned).

Python:

import json
import requests


url = "https://api.mohawkanalytics.com/classifiedads/gb/v1/query"

# Example values for claimant's information
claimant_item = "iPhone 10"
claimant_phone_number = "+4712345678"
claim_value = 8000 # NOK

query = {
"any": {
"text": [claimant_item],
"phone": [claimant_phone_number],
"price": {"lowerValue": claim_value - 2000, "upperValue": claim_value + 2000},
}
}
json_string = json.dumps(query)

headers = {"API-Key": "<YOUR_API_KEY>"}
data = {"query": json_string, "limit": 20, "offset": 0, "select": None}

response = requests.post(url, data=data, headers=headers)

print(response.json())

Depending on the query your run, and the country you run it for zero, one or multiple results will be given as feedback.

Note that: the ANY key is supposed to work as an OR if your query provides multiple values for a certain key. So: query = {"any":{"text":["Volvo","Audi"]}} is giving results that have text = Volvo OR text = Audi.

In case an API-user passes a list of  key-value pairs in our ANY key, then we interpret the follow query: query = {"any":{"text":["Volvo","Audi"], "phone":["+4712345678","+4787654321"]}}

Return all results that have text = Volvo OR text = Audi AND phone = +4712345678 OR phone = +4787654321

Based on our research, we concluded that most of our API users are currently searching for queries that support the second interpretation of the ANY query. As a result, our current implementation processes the ANY key to process queries like the above.