Programmatic Access to Session Data
While the Entrupy iOS SDK provides comprehensive UI components like the Detail Screen UI for displaying item authentication status and details, there are scenarios where you may need to present parts of this data inside your own app UI.
This guide explains the supported patterns for programmatic access to item/session data.
Overview
The iOS SDK does not expose one universal "fetch full session details" method. In practice, you access session data through:
- Search APIs (
searchSubmissions,searchAuthenticationItems) for lookup and retrieval - Flag/detail APIs for specific item-level actions
- SDK-hosted views (for full, rich item detail and user actions)
- SDK callbacks (
EntrupyCaptureDelegate,EntrupySearchDelegate) as event-driven data entry points
There is currently no single SDK method that fetches a full session payload by Entrupy Session ID alone. To retrieve authentications by Entrupy ID, use search APIs (for example, searchSubmissions) with the appropriate filter so results are consistent with SKU-based lookups.
For bulk reporting, analytics, and multi-item processing, use the Entrupy API on your backend. Mobile SDK programmatic access is best for app-level, user-driven interactions.
Supported Access Patterns
1) Search-based retrieval (recommended for lookups)
For retrieval by identifier, filters, or time range, use:
searchSubmissions(at:filters:startDate:endDate:paginationLimit:)(legacy-style search)searchAuthenticationItems(query:completion:)(query-based search with cursor pagination)
These responses can be decoded into models like EntrupySearchResult / EntrupySearchItemsResult depending on the API used.
2) Capture result callback
When capture succeeds, didCaptureCompleteSuccessfully(_:forItem:) returns a result payload that typically includes the authentication identifier (entrupy_id), status data, and related metadata.
func didCaptureCompleteSuccessfully(
_ result: [AnyHashable: Any],
forItem item: [AnyHashable: Any]
) {
do {
let jsonData = try JSONSerialization.data(withJSONObject: result)
let parsedResult = try JSONDecoder().decode(EntrupyCaptureResult.self, from: jsonData)
let entrupyId = parsedResult.item.entrupyId
let statusHeader = parsedResult.status.result.display.header
print("Capture complete: \(entrupyId ?? "N/A") status=\(statusHeader)")
} catch {
print("Failed to decode capture result: \(error)")
}
}
3) Item-specific detail actions
For item-level support/status interactions, use dedicated APIs such as:
getFlagDetailsForResult(withEntrupyID:completion:)setFlag(_:forResultWithEntrupyID:flagReasonId:message:)
For full item context and interactive UX, present the Detail Screen UI via:
displayDetailViewForItem(withEntrupyID:withConfiguration:)
Common Data You Will Use
entrupy_id: The unique Entrupy identifier for the authentication session.- Status Information: Processing state and final result display fields.
- ETA/Timing Fields: Estimated completion information while processing is in progress.
- Item Properties: Brand,
customer_item_id, and item metadata submitted during capture. - Flag Data: Current flag state/details and eligibility.
- MarketEdge and Certificate Fields (when available for the item/result).
Use Cases
- Displaying a concise summary of an item's status in a list view within your app.
- Integrating specific data points (e.g., final result, certificate link) into a custom item detail screen that combines Entrupy data with your own application's information.
- Triggering application-specific workflows based on the authentication status or result.
Best Practices
- Asynchronous Operations: Data fetching should be asynchronous to avoid blocking the main thread. Update your UI on the main thread upon completion.
- Defensive Decoding: Avoid force-casts (
as!) for SDK dictionaries; use safe decoding and fallback handling. - Error Handling: Implement robust handling for network issues, invalid IDs, and decode failures.
- Data Consistency: If you show custom summary UI and also use SDK-hosted views, keep field labels and status terms consistent.
- Prioritize SDK UI for full workflows: For complete item interactions (timeline, retakes, flag UX), direct users to the Detail Screen UI.
Using these patterns lets you build custom app experiences while keeping full lifecycle workflows inside supported SDK views.
Next Steps
- Learn about Programmatic Customer Support for interacting with flags and support messages.
- Explore Programmatic Search for Authentication Items for advanced search queries with filtering and pagination.
- Review how to use Search Authentications to load item lists for custom UI.
- Explore the Understanding MarketEdge in SDK guide.