Skip to content

Commit 2d197d4

Browse files
authored
copy edit on readme + update doc URLs (#21)
* copy edit on readme + update doc URLs * typo fix
1 parent 8147323 commit 2d197d4

File tree

8 files changed

+51
-46
lines changed

8 files changed

+51
-46
lines changed

README.md

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
# UID2 Java SDK
1+
# UID2 SDK for Java
22

33
The UID 2 Project is subject to the IAB Tech Lab Intellectual Property Rights (IPR) Policy, and is managed by the IAB Tech Lab Addressability Working Group and [Privacy & Rearc Commit Group](https://iabtechlab.com/working-groups/privacy-rearc-commit-group/). Please review the [governance rules](https://github.com/IABTechLab/uid2-core/blob/master/Software%20Development%20and%20Release%20Procedures.md).
44

55
This document includes:
6-
* [Who is this SDK for?](#who-is-this-sdk-for)
6+
* [Who Is this SDK for?](#who-is-this-sdk-for)
77
* [Requirements](#requirements)
8-
* [Installation](#installation)
8+
* [Install](#install)
99
* [Usage for DSPs](#usage-for-dsps)
1010
* [Usage for Publishers](#usage-for-publishers)
1111
- [Basic Usage](#basic-usage)
1212
- [Advanced Usage](#advanced-usage)
13-
* [## Usage for UID Sharers](#usage-for-uid-sharers)
13+
* [## Usage for UID2 Sharers](#usage-for-uid2-sharers)
1414

15-
## Who is this SDK for?
16-
This SDK simplifies integration with UID2 for Publishers, DSPs, and UID Sharers, as described in the [UID2 Integration Guides](https://github.com/IABTechLab/uid2docs/blob/main/api/v2/guides/summary-guides.md).
15+
## Who Is this SDK for?
16+
17+
This SDK simplifies integration with UID2 for Publishers, DSPs, and UID Sharers, as described in [UID2 Integration Guides](https://unifiedid.com/docs/category/integration-guides).
1718

1819
## Requirements
1920

20-
* This SDK requires Java version 1.8 or later.
21+
This SDK requires Java version 1.8 or later.
2122

22-
## Installation
23+
## Install
2324

24-
Add this dependency to your project's POM:
25+
To install the SDK, add this dependency to your project's `pom.xml` file:
2526

2627
```
2728
<dependency>
@@ -38,10 +39,10 @@ For an example of usage for DSPs, see [com.uid2.client.test.IntegrationExamples]
3839
## Usage for Publishers
3940

4041
As a publisher, there are two ways to use this SDK:
41-
1. [**Basic Usage**](#basic-usage) is for publishers who are happy to use this SDK's HTTP implementation (synchronous [OkHttp](https://square.github.io/okhttp/)).
42+
1. [**Basic Usage**](#basic-usage) is for publishers who want to use this SDK's HTTP implementation (synchronous [OkHttp](https://square.github.io/okhttp/)).
4243
2. [**Advanced Usage**](#advanced-usage) is for publishers who prefer to use their own HTTP library.
4344

44-
For an example application that demonstrates both Basic and Advanced usage, see [uid2-examples](https://github.com/UnifiedID2/uid2-examples/tree/main/publisher/uid2-java-test-site).
45+
For an example application that demonstrates both Basic and Advanced usage, see [Java UID2 Integration Example](https://github.com/UnifiedID2/uid2-examples/tree/main/publisher/uid2-java-test-site#readme).
4546

4647
### Basic Usage
4748

@@ -57,13 +58,15 @@ If you're using the SDK's HTTP implementation, follow these steps.
5758

5859
#### Standard Integration
5960

60-
If you're using [standard (client and server) integration](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/publisher-client-side.md), follow this step:
61+
If you're using standard integration (client and server) (see [Client-Side JavaScript SDK Integration Guide](https://unifiedid.com/docs/guides/publisher-client-side)), follow this step:
62+
63+
* Send this identity as a JSON string back to the client (to use in the [identity field](https://unifiedid.com/docs/sdks/client-side-identity#initopts-object-void)) using the following:
6164

62-
* Send this identity as a JSON string back to the client (to use in the [identity field](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/sdks/client-side-identity.md#initopts-object-void)) using: `identity.getJsonString()`
65+
`identity.getJsonString()`
6366

6467
#### Server-Only Integration
6568

66-
If you're using [server-only integration](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/custom-publisher-integration.md):
69+
If you're using server-only integration (see [Publisher Integration Guide, Server-Only (Without SDK)](https://unifiedid.com/docs/guides/custom-publisher-integration)):
6770

6871
1. Store this identity as a JSON string in the user's session, using the `identity.getJsonString()` function.
6972
2. To use the user's UID2 token, use the `identity.getAdvertisingToken()` function.
@@ -81,37 +84,39 @@ If you're using [server-only integration](https://github.com/UnifiedID2/uid2docs
8184

8285
`TokenRefreshResponse tokenRefreshResponse = publisherUid2Client.refreshToken(identity);`
8386

84-
5. You should then store `tokenRefreshResponse.getIdentityJsonString()` in the user's session. If the user has opted out, this method returns null, indicating that the user's identity should be removed from their session. (Optout can be confirmed via `tokenRefreshResponse.isOptout()`.)
87+
5. Store `tokenRefreshResponse.getIdentityJsonString()` in the user's session. If the user has opted out, this method returns null, indicating that the user's identity should be removed from the session. To confirm optout, you can use the `tokenRefreshResponse.isOptout()` function.
8588

8689
### Advanced Usage
8790

8891
1. Create an instance of PublisherUid2Helper as an instance variable:
8992

9093
`private final PublisherUid2Helper publisherUid2Helper = new PublisherUid2Helper(UID2_SECRET_KEY);`
91-
2. When the user has authenticated, and has authorized the creation of a UID2, call a function that takes the user's email address or phone number as input and creates a secure request data envelope. See [Encrypting requests](https://github.com/IABTechLab/uid2docs/blob/main/api/v2/getting-started/gs-encryption-decryption.md#encrypting-requests). The following example uses an email address:
94+
2. When the user has authenticated, and has authorized the creation of a UID2, call a function that takes the user's email address or phone number as input and creates a secure request data envelope. See [Encrypting requests](https://unifiedid.com/docs/getting-started/gs-encryption-decryption#encrypting-requests). The following example uses an email address:
9295

9396
`EnvelopeV2 envelope = publisherUid2Helper.createEnvelopeForTokenGenerateRequest(TokenGenerateInput.fromEmail(emailAddress));`
94-
3. Using an HTTP client library of your choice, post this envelope to the [/v2/token/generate](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md) endpoint, including headers and body:
97+
3. Using an HTTP client library of your choice, post this envelope to the [POST token/generate](https://unifiedid.com/docs/endpoints/post-token-generate) endpoint, including headers and body:
9598
1. Headers: Depending on your HTTP library, this might look something like the following:
9699

97100
`.putHeader("Authorization", "Bearer " + UID2_API_KEY)`
98101
`.putHeader("X-UID2-Client-Version", PublisherUid2Helper.getVersionHeader())`
99102
2. Body: `envelope.getEnvelope()`
100-
4. If the HTTP response status code is _not_ 200, see [Response Status Codes](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md#response-status-codes) to determine next steps. Otherwise, convert the UID2 identity response content into an `IdentityTokens` object:
103+
4. If the HTTP response status code is _not_ 200, see [Response Status Codes](https://unifiedid.com/docs/endpoints/post-token-generate#response-status-codes) to determine next steps. Otherwise, convert the UID2 identity response content into an `IdentityTokens` object:
101104

102105
`IdentityTokens identity = publisherUid2Helper.createIdentityfromTokenGenerateResponse({response body}, envelope);`
103106

104107
#### Standard Integration
105108

106-
If you're using [standard (client and server) integration](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/publisher-client-side.md):
109+
If you're using standard integration (client and server) (see [Client-Side JavaScript SDK Integration Guide](https://unifiedid.com/docs/guides/publisher-client-side)):
110+
111+
* Send this identity as a JSON string back to the client (to use in the [identity field](https://unifiedid.com/docs/sdks/client-side-identity#initopts-object-void)) using the following:
107112

108-
1. Send this identity as a JSON string back to the client (to use in the [identity field](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/sdks/client-side-identity.md#initopts-object-void)) using: `identity.getJsonString()`
113+
`identity.getJsonString()`
109114

110115
#### Server-Only Integration
116+
If you're using server-only integration (see [Publisher Integration Guide, Server-Only (Without SDK)](https://unifiedid.com/docs/guides/custom-publisher-integration)):
111117

112-
If you're using [server-only integration](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/custom-publisher-integration.md):
113-
1. Store this identity as a JSON string in the user's session, using: `identity.getJsonString()`
114-
2. To use the user's UID2 token, use `identity.getAdvertisingToken()`
118+
1. Store this identity as a JSON string in the user's session, using: `identity.getJsonString()`.
119+
2. To use the user's UID2 token, use `identity.getAdvertisingToken()`.
115120

116121
3. When the user accesses another page, or on a timer, determine whether a refresh is needed:
117122
1. Retrieve the identity JSON string from the user's session, and then call the following function that generates an `IdentityTokens` object:
@@ -123,7 +128,7 @@ If you're using [server-only integration](https://github.com/UnifiedID2/uid2docs
123128
3. Determine if a refresh is needed:
124129

125130
`if (identity.isDueForRefresh()) {..}`
126-
4. If a refresh is needed, call the [POST token/refresh](https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-refresh.md) endpoint, with:
131+
4. If a refresh is needed, call the [POST token/refresh](https://unifiedid.com/docs/endpoints/post-token-refresh) endpoint, with:
127132
1. Headers (depending on your HTTP library, this might look something like):
128133

129134
`.putHeader("Authorization", "Bearer " + UID2_API_KEY)`
@@ -132,11 +137,11 @@ If you're using [server-only integration](https://github.com/UnifiedID2/uid2docs
132137
5. If the refresh HTTP response status code is 200:
133138

134139
`TokenRefreshResponse tokenRefreshResponse = PublisherUid2Helper.createTokenRefreshResponse({response body}, identity);`
135-
6. You should then store `tokenRefreshResponse.getIdentityJsonString()` in the user's session. If the user has opted out, this method returns null, indicating that the user's identity should be removed from their session (you can confirm user opt-out with the `tokenRefreshResponse.isOptout()` function).
140+
6. Store `tokenRefreshResponse.getIdentityJsonString()` in the user's session. If the user has opted out, this method returns null, indicating that the user's identity should be removed from the session. To confirm optout, you can use the `tokenRefreshResponse.isOptout()` function.
136141

137-
## Usage for UID Sharers
142+
## Usage for UID2 Sharers
138143

139-
A UID2 Sharer is a participant that wants to share UID2s or EUIDs with another participant. Raw UIDs must be encrypted into UID tokens before sending them to another participant. For an example of usage, see [com.uid2.client.test.IntegrationExamples](https://github.com/IABTechLab/uid2-client-java/blob/master/src/test/java/com/uid2/client/test/IntegrationExamples.java) (runSharingExample method).
144+
A UID2 sharer is a participant that wants to share UID2s or EUIDs with another participant. Raw UID2s must be encrypted into UID2 tokens before sending them to another participant. For an example of usage, see [com.uid2.client.test.IntegrationExamples](https://github.com/IABTechLab/uid2-client-java/blob/master/src/test/java/com/uid2/client/test/IntegrationExamples.java) (runSharingExample method).
140145

141146
1. Use UID2ClientFactory.create() to create an IUID2Client reference:
142147

@@ -148,13 +153,13 @@ A UID2 Sharer is a participant that wants to share UID2s or EUIDs with another p
148153
1. Call the following:
149154

150155
`EncryptionDataResponse encrypted = client.encrypt(rawUid);`
151-
2. If encryption succeeded, send the UID token to the receiver:
156+
2. If encryption succeeded, send the UID2 token to the receiver:
152157

153158
`if (encrypted.isSuccess()) {` send `encrypted.getEncryptedData()` to receiver`} else {`check `encrypted.getStatus()` for the failure reason}
154159
4. Receivers:
155160
1. Call the following:
156161

157162
`DecryptionResponse decrypted = client.decrypt(uidToken);`
158-
2. If decryption succeeded, use the raw UID:
163+
2. If decryption succeeded, use the raw UID2:
159164

160165
`if (decrypted.isSuccess()) {`use `decrypted.getUid() } else {`check `decrypted.getStatus()` for the failure reason `}`

src/main/java/com/uid2/client/EnvelopeV2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public class EnvelopeV2 {
88
}
99

1010
/**
11-
* @return an encrypted request envelope which can be used in the POST body of a <a href="https://github.com/UnifiedID2/uid2docs/tree/main/api/v2/endpoints">UID2 endpoint</a>.
12-
* See <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/encryption-decryption.md#encrypted-request-envelope">Encrypted Request Envelope</a>
11+
* @return an encrypted request envelope which can be used in the POST body of a <a href="https://unifiedid.com/docs/endpoints/summary-endpoints">UID2 endpoint</a>.
12+
* See <a href="https://unifiedid.com/docs/getting-started/gs-encryption-decryption#encrypted-request-envelope">Encrypted Request Envelope</a>
1313
*/
1414
public String getEnvelope() { return envelope; }
1515
byte[] getNonce() { return nonce;}

src/main/java/com/uid2/client/IdentityTokens.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static public IdentityTokens fromJsonString(String jsonString) {
2727
}
2828

2929
/**
30-
* @return whether this identity is due to be refreshed. If true, a call to <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-refresh.md">/token/refresh</a> is due.
30+
* @return whether this identity is due to be refreshed. If true, a call to <a href="https://unifiedid.com/docs/endpoints/post-token-refresh">/token/refresh</a> is due.
3131
*/
3232
public boolean isDueForRefresh() {
3333
return isDueForRefreshImpl(Instant.now());
@@ -39,13 +39,13 @@ public boolean isDueForRefresh() {
3939
public String getAdvertisingToken() { return advertisingToken; }
4040

4141
/**
42-
* @return the refresh token. This is used as the POST body in <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-refresh.md">/token/refresh</a>
42+
* @return the refresh token. This is used as the POST body in <a href="https://unifiedid.com/docs/endpoints/post-token-refresh">/token/refresh</a>
4343
*/
4444
public String getRefreshToken() { return refreshToken; }
4545

4646
/**
47-
* @return the identity as represented by a JSON string. This should be sent back to the client if using <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/publisher-client-side.md">standard integration</a>,
48-
* or stored in the user's session if using <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/guides/custom-publisher-integration.md">Server-Only integration.</a>
47+
* @return the identity as represented by a JSON string. This should be sent back to the client if using <a href="https://unifiedid.com/docs/guides/publisher-client-side">standard integration</a>,
48+
* or stored in the user's session if using <a href="https://unifiedid.com/docs/guides/custom-publisher-integration">Server-Only integration.</a>
4949
*/
5050
public String getJsonString() {return jsonString;} //this ensures we make newly added fields available, even before this class is updated.
5151

src/main/java/com/uid2/client/PublisherUid2Client.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class PublisherUid2Client {
99
/**
10-
* @param uid2BaseUrl The <a href="https://github.com/UnifiedID2/uid2docs/tree/main/api/v2#environments">UID2 Base URL</a>
10+
* @param uid2BaseUrl The <a href="https://unifiedid.com/docs/getting-started/gs-environments">UID2 Base URL</a>
1111
* @param clientApiKey Your client API key
1212
* @param base64SecretKey Your client secret key
1313
*/
@@ -18,7 +18,7 @@ public PublisherUid2Client(String uid2BaseUrl, String clientApiKey, String base6
1818
}
1919

2020
/**
21-
* @param tokenGenerateInput represents the input required for <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md#unencrypted-json-body-parameters">/token/generate</a>
21+
* @param tokenGenerateInput represents the input required for <a href="https://unifiedid.com/docs/endpoints/post-token-generate#unencrypted-json-body-parameters">/token/generate</a>
2222
* @return an IdentityTokens instance
2323
* @throws Uid2Exception if the response did not contain a "success" status, or the response code was not 200, or there was an error communicating with the provided UID2 Base URL
2424
*/

src/main/java/com/uid2/client/PublisherUid2Helper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public PublisherUid2Helper(String base64SecretKey) {
2323
}
2424

2525
/**
26-
* @param tokenGenerateInput represents the input required for <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md#unencrypted-json-body-parameters">/token/generate</a>
27-
* @return an EnvelopeV2 instance to use in the POST body of <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md">/token/generate</a>
26+
* @param tokenGenerateInput represents the input required for <a href="https://unifiedid.com/docs/endpoints/post-token-generate#unencrypted-json-body-parameters">/token/generate</a>
27+
* @return an EnvelopeV2 instance to use in the POST body of <a href="https://unifiedid.com/docs/endpoints/post-token-generate">/token/generate</a>
2828
*/
2929
public EnvelopeV2 createEnvelopeForTokenGenerateRequest(TokenGenerateInput tokenGenerateInput) {
3030
final int nonceLength = 8;
@@ -34,7 +34,7 @@ public EnvelopeV2 createEnvelopeForTokenGenerateRequest(TokenGenerateInput token
3434
}
3535

3636
/**
37-
* @param response the response body returned by a call to <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-generate.md">/token/generate</a>
37+
* @param response the response body returned by a call to <a href="https://unifiedid.com/docs/endpoints/post-token-generate">/token/generate</a>
3838
* @param envelope the EnvelopeV2 instance returned by {@link #createEnvelopeForTokenGenerateRequest}
3939
* @return an IdentityTokens instance
4040
* @throws Uid2Exception if the response did not contain a "success" status
@@ -51,7 +51,7 @@ public IdentityTokens createIdentityfromTokenGenerateResponse(String response, E
5151
}
5252

5353
/**
54-
* @param encryptedResponse the response body returned by a call to <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-refresh.md">/token/refresh</a>
54+
* @param encryptedResponse the response body returned by a call to <a href="https://unifiedid.com/docs/endpoints/post-token-refresh">/token/refresh</a>
5555
* @param currentIdentity the current IdentityTokens instance, typically retrieved from a user's session
5656
* @return the refreshed IdentityTokens instance (with a new advertising token and updated expiry times). Typically, this will be used to replace the current identity in the user's session
5757
*/

src/main/java/com/uid2/client/TokenGenerateInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static TokenGenerateInput fromEmail(String email) {
1414
}
1515

1616
/**
17-
* @param phone a <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/README.md#phone-number-normalization">normalized</a> phone number
17+
* @param phone a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-normalization">normalized</a> phone number
1818
* @return a TokenGenerateInput instance, to be used in {@link PublisherUid2Helper#createEnvelopeForTokenGenerateRequest}
1919
*/
2020
public static TokenGenerateInput fromPhone(String phone) {

src/main/java/com/uid2/client/TokenRefreshResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public boolean isSuccess() {
2121
}
2222

2323
/**
24-
* @return whether the user has opted out. See <a href="https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/endpoints/post-token-refresh.md#optout">Optout</a>
24+
* @return whether the user has opted out. See <a href="https://unifiedid.com/docs/endpoints/post-token-refresh#optout">Optout</a>
2525
*/
2626
public boolean isOptout() {
2727
return "optout".equals(status);

0 commit comments

Comments
 (0)