Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/validate-id-path-parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'java-sdk': patch
---

**sdk**: `getEvent`, `updateEvent`, and `deleteVisitorData` now validate their ID path parameter and throw an `ApiException` without sending a request when the value is not a valid identifier.
6 changes: 3 additions & 3 deletions docs/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class FingerprintApiExample {

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **visitorId** | **String**| The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. | |
| **visitorId** | **String**| The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. A value that is not a valid identifier is rejected before a request is sent. | |

### Return type

Expand Down Expand Up @@ -171,7 +171,7 @@ public class FingerprintApiExample {

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **eventId** | **String**| The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). | |
| **eventId** | **String**| The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). A value that is not a valid identifier is rejected before a request is sent. | |
| **getEventOptionalParams** | [**FingerprintApi.GetEventOptionalParams**](#fingerprintapigeteventoptionalparams) | | [optional] |

#### FingerprintApi.GetEventOptionalParams
Expand Down Expand Up @@ -541,7 +541,7 @@ public class FingerprintApiExample {

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **eventId** | **String**| The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). | |
| **eventId** | **String**| The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). A value that is not a valid identifier is rejected before a request is sent. | |
| **eventUpdate** | [**EventUpdate**](EventUpdate.md)| | |

### Return type
Expand Down
42 changes: 29 additions & 13 deletions sdk/src/main/java/com/fingerprint/v4/api/FingerprintApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void setApiClient(ApiClient apiClient) {
/**
* Delete a visitor ID
* Use this API to request the deletion of all data associated with a specific visitor ID. Upon a request to delete data for a visitor ID, - The data collected from the corresponding browser (or device) will be deleted asynchronously, typically within a few minutes. This data will no longer be available to identify this browser (or device). When the same browser (or device) revisits, it will receive a new visitor ID. - The identification events made from this browser (or device) in the past 10 days are typically deleted within 24 hrs. - The identification events made from this browser (or device) outside of the 10 days will be purged as per your [data retention period](https://docs.fingerprint.com/docs/regions#data-retention). The following timeline illustrates which events are deleted and which remain after a DELETE API request: ``` Day 1: First visit from browser A. (Assigned visitor ID: VID1000) Day 2: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 13: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 14: Delete VID1000 Day 15: Browser A re-visits. (Assigned a different visitor ID: VID9999) Day 15: GET /events/day-13 (Returns 404. The event is within the 10 days of deleting VID1000 and will have been deleted) Day 16: GET /events/day-2 (Returns 200. The event is outside of the 10 days of deleting VID1000 and is still available) ``` ### Availability This API is available only for Enterprise plans **upon request**. If you are interested, please [contact our support team](https://fingerprint.com/support/). ### Rate limits and daily quota The rate limits and daily quota for this API **differ** from those for our other API. The maximum number of DELETE requests that can be made in an hour cannot exceed 30 RPH, and the maximum number that can be made in a day cannot exceed 500 RPD. You can request an increase to these limits by contacting [our support team](https://fingerprint.com/support/).
* @param visitorId The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
* @param visitorId The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @throws ApiException if fails to make API call
* @http.response.details
* <table summary="Response Details" border="1">
Expand All @@ -89,7 +89,7 @@ public void deleteVisitorData(String visitorId) throws ApiException {
/**
* Delete a visitor ID
* Use this API to request the deletion of all data associated with a specific visitor ID. Upon a request to delete data for a visitor ID, - The data collected from the corresponding browser (or device) will be deleted asynchronously, typically within a few minutes. This data will no longer be available to identify this browser (or device). When the same browser (or device) revisits, it will receive a new visitor ID. - The identification events made from this browser (or device) in the past 10 days are typically deleted within 24 hrs. - The identification events made from this browser (or device) outside of the 10 days will be purged as per your [data retention period](https://docs.fingerprint.com/docs/regions#data-retention). The following timeline illustrates which events are deleted and which remain after a DELETE API request: ``` Day 1: First visit from browser A. (Assigned visitor ID: VID1000) Day 2: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 13: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 14: Delete VID1000 Day 15: Browser A re-visits. (Assigned a different visitor ID: VID9999) Day 15: GET /events/day-13 (Returns 404. The event is within the 10 days of deleting VID1000 and will have been deleted) Day 16: GET /events/day-2 (Returns 200. The event is outside of the 10 days of deleting VID1000 and is still available) ``` ### Availability This API is available only for Enterprise plans **upon request**. If you are interested, please [contact our support team](https://fingerprint.com/support/). ### Rate limits and daily quota The rate limits and daily quota for this API **differ** from those for our other API. The maximum number of DELETE requests that can be made in an hour cannot exceed 30 RPH, and the maximum number that can be made in a day cannot exceed 500 RPD. You can request an increase to these limits by contacting [our support team](https://fingerprint.com/support/).
* @param visitorId The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
* @param visitorId The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @return ApiResponse<Void>
* @throws ApiException if fails to make API call
* @http.response.details
Expand All @@ -111,10 +111,16 @@ public ApiResponse<Void> deleteVisitorDataWithHttpInfo(String visitorId) throws
400, "Missing the required parameter 'visitorId' when calling deleteVisitorData");
}

// verify the path parameter 'visitorId' is a valid identifier
String escapedVisitorId = apiClient.escapeString(visitorId.toString());
if (escapedVisitorId.equals(".") || escapedVisitorId.equals("..")) {
throw new ApiException(
"invalid value \"" + escapedVisitorId + "\" for path parameter visitorId");
}

// create path and map variables
String localVarPath =
"/visitors/{visitor_id}"
.replaceAll("\\{" + "visitor_id" + "\\}", apiClient.escapeString(visitorId.toString()));
"/visitors/{visitor_id}".replaceAll("\\{" + "visitor_id" + "\\}", escapedVisitorId);

// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Expand Down Expand Up @@ -167,7 +173,7 @@ public GetEventOptionalParams setRulesetId(String rulesetId) {
/**
* Get an event by event ID
* Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`.
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @return Event
* @throws ApiException if fails to make API call
* @http.response.details
Expand All @@ -189,7 +195,7 @@ public Event getEvent(String eventId) throws ApiException {
/**
* Get an event by event ID
* Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`.
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @param getEventOptionalParams Object containing optional parameters for API method. (optional)
* @return Event
* @throws ApiException if fails to make API call
Expand All @@ -213,7 +219,7 @@ public Event getEvent(String eventId, GetEventOptionalParams getEventOptionalPar
/**
* Get an event by event ID
* Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`.
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
* @param eventId The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @param getEventOptionalParams Object containing optional parameters for API method. (optional)
* @return ApiResponse<Event>
* @throws ApiException if fails to make API call
Expand All @@ -238,10 +244,15 @@ public ApiResponse<Event> getEventWithHttpInfo(
throw new ApiException(400, "Missing the required parameter 'eventId' when calling getEvent");
}

// verify the path parameter 'eventId' is a valid identifier
String escapedEventId = apiClient.escapeString(eventId.toString());
if (escapedEventId.equals(".") || escapedEventId.equals("..")) {
throw new ApiException("invalid value \"" + escapedEventId + "\" for path parameter eventId");
}

// create path and map variables
String localVarPath =
"/events/{event_id}"
.replaceAll("\\{" + "event_id" + "\\}", apiClient.escapeString(eventId.toString()));
"/events/{event_id}".replaceAll("\\{" + "event_id" + "\\}", escapedEventId);

// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Expand Down Expand Up @@ -1395,7 +1406,7 @@ public ApiResponse<EventSearch> searchEventsWithHttpInfo(
/**
* Update an event
* Change information in existing events specified by `event_id` or *flag suspicious events*. When an event is created, it can be assigned `linked_id` and `tags` submitted through the JS agent parameters. This information might not have been available on the client initially, so the Server API permits updating these attributes after the fact. **Warning** It's not possible to update events older than one month. **Warning** Trying to update an event immediately after creation may temporarily result in an error (HTTP 409 Conflict. The event is not mutable yet.) as the event is fully propagated across our systems. In such a case, simply retry the request.
* @param eventId The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
* @param eventId The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @param eventUpdate (required)
* @throws ApiException if fails to make API call
* @http.response.details
Expand All @@ -1415,7 +1426,7 @@ public void updateEvent(String eventId, EventUpdate eventUpdate) throws ApiExcep
/**
* Update an event
* Change information in existing events specified by `event_id` or *flag suspicious events*. When an event is created, it can be assigned `linked_id` and `tags` submitted through the JS agent parameters. This information might not have been available on the client initially, so the Server API permits updating these attributes after the fact. **Warning** It's not possible to update events older than one month. **Warning** Trying to update an event immediately after creation may temporarily result in an error (HTTP 409 Conflict. The event is not mutable yet.) as the event is fully propagated across our systems. In such a case, simply retry the request.
* @param eventId The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
* @param eventId The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required) A value that is not a valid identifier is rejected with an {@link ApiException} before a request is sent.
* @param eventUpdate (required)
* @return ApiResponse<Void>
* @throws ApiException if fails to make API call
Expand Down Expand Up @@ -1445,10 +1456,15 @@ public ApiResponse<Void> updateEventWithHttpInfo(String eventId, EventUpdate eve
400, "Missing the required parameter 'eventUpdate' when calling updateEvent");
}

// verify the path parameter 'eventId' is a valid identifier
String escapedEventId = apiClient.escapeString(eventId.toString());
if (escapedEventId.equals(".") || escapedEventId.equals("..")) {
throw new ApiException("invalid value \"" + escapedEventId + "\" for path parameter eventId");
}

// create path and map variables
String localVarPath =
"/events/{event_id}"
.replaceAll("\\{" + "event_id" + "\\}", apiClient.escapeString(eventId.toString()));
"/events/{event_id}".replaceAll("\\{" + "event_id" + "\\}", escapedEventId);

// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Expand Down
Loading
Loading