Skip to content

Commit 7cbff81

Browse files
committed
Clearer optional steps for Java SDK.
1 parent 62adee8 commit 7cbff81

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

docs/sdks/sdk-ref-java.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -447,46 +447,47 @@ import com.uid2.client.UnmappedIdentityReason;
447447

448448
### Recommended Changes
449449

450-
1. **Update input construction**:
450+
The following changes are **optional** but allow you to take advantage of new v3 features. The required changes above are sufficient for basic functionality, but these recommended changes enable improved capabilities.
451+
452+
1. **Mix identity types in a single request** - Process both email addresses and phone numbers together:
451453
```java
452-
// Before
454+
// Before - single identity type only
453455
IdentityMapInput input = IdentityMapInput.fromEmails(Arrays.asList("[email protected]"));
454456

455-
// After - single identity type
456-
IdentityMapV3Input input = IdentityMapV3Input.fromEmails(Arrays.asList("[email protected]"));
457-
458-
// Alternatively - mix identity types (new capability)
457+
// After - can mix identity types (new v3 capability)
459458
IdentityMapV3Input input = new IdentityMapV3Input()
460459
.withEmail("[email protected]")
461-
.withPhone("+12345678901");
460+
.withPhone("+12345678901")
461+
.withHashedEmail("preHashedEmail")
462+
.withHashedPhone("preHashedPhone");
462463
```
463464

464-
2. **Update response handling**:
465+
2. **Access previous UID2s** - Get both current and previous UID2s for 90-day measurement continuity:
465466
```java
466-
// Before
467+
// Before - only current UID2 available
467468
IdentityMapResponse response = client.generateIdentityMap(input);
468469
MappedIdentity mapped = response.getMappedIdentities().get("[email protected]");
469470
String uid = mapped.getRawUid();
470471

471-
// After
472+
// After - access to both current and previous UID2s
472473
IdentityMapV3Response response = client.generateIdentityMap(input);
473474
IdentityMapV3Response.MappedIdentity mapped = response.getMappedIdentities().get("[email protected]");
474475
String currentUid = mapped.getCurrentRawUid();
475-
String previousUid = mapped.getPreviousRawUid();
476+
String previousUid = mapped.getPreviousRawUid(); // Available for 90 days after rotation
476477
Instant refreshFrom = mapped.getRefreshFrom();
477478
```
478479

479-
3. **Update error handling**:
480+
3. **Use structured error reasons** - Get unmapped reasons as strongly-typed enums instead of strings:
480481
```java
481-
// Before
482+
// Before - string-based error reasons
482483
IdentityMapResponse.UnmappedIdentity unmapped = identityMapResponse.getUnmappedIdentities().get("[email protected]");
483484
String reason = unmapped.getReason();
484485

485-
// After - structured error reasons
486+
// After - structured enum-based error reasons
486487
IdentityMapV3Response.UnmappedIdentity unmapped = response.getUnmappedIdentities().get("[email protected]");
487-
UnmappedIdentityReason reason = unmapped.getReason(); // Enum - OPTOUT, INVALID_IDENTIFIER, UNKNOWN
488+
UnmappedIdentityReason reason = unmapped.getReason(); // Enum: OPTOUT, INVALID_IDENTIFIER, UNKNOWN
488489

489-
// Alternatively you can get reason as a string, values match the old ones
490+
// Or continue using string reasons if preferred
490491
String rawReason = unmapped.getRawReason();
491492
```
492493

0 commit comments

Comments
 (0)