Skip to content

Commit 95d6661

Browse files
committed
docs: add search events usage example to the readme
1 parent ab115e8 commit 95d6661

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,36 @@ except ApiException as e:
149149
print("Exception when calling FingerprintApi->get_event: %s\n" % e)
150150
```
151151

152+
Search events with custom filters:
153+
```python
154+
import fingerprint_pro_server_api_sdk
155+
from fingerprint_pro_server_api_sdk.rest import ApiException, KnownApiException
156+
157+
configuration = fingerprint_pro_server_api_sdk.Configuration(api_key="SECRET_API_KEY")
158+
api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
159+
160+
limit = 20 # int | Limit the number of events returned.
161+
visitor_id = 'VISITOR_ID' # str | Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`. (optional)
162+
bot = 'good' # str | Filter events by the bot detection result, specifically: events where <'any'|'good'|'bad'|'none'> kind of bot was detected. (optional)
163+
ip_address = '192.168.0.1/32' # str | Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6) All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32 (optional)
164+
linked_id = 'linked_id_example' # str | Filter events by your custom identifier. You can use [linked IDs](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example, session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
165+
start = 1738687200000 # int | Filter events with a timestamp greater than the start time, in Unix time (milliseconds). (optional)
166+
end = 1738773600000 # int | Filter events with a timestamp smaller than the end time, in Unix time (milliseconds). (optional)
167+
reverse = True # bool | Sort events in reverse timestamp order. (optional)
168+
suspect = False # bool | Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent). (optional)
169+
170+
try:
171+
# Get events via search
172+
api_response = api_instance.search_events(limit, visitor_id=visitor_id, bot=bot, ip_address=ip_address, linked_id=linked_id, start=start, end=end, reverse=reverse, suspect=suspect)
173+
print(api_response)
174+
175+
except KnownApiException as e:
176+
structured_error = e.structured_error
177+
print("Error code: %s. Error message: %s\n" % (structured_error.error.code, structured_error.error.message))
178+
except ApiException as e:
179+
print("Exception when calling FingerprintApi->get_event: %s\n" % e)
180+
```
181+
152182
Update event for requestId:
153183
```python
154184
import fingerprint_pro_server_api_sdk

0 commit comments

Comments
 (0)