Skip to content

Commit

Permalink
feat: add update event endpoint (PUT)
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkuncakilkaya committed Aug 26, 2024
1 parent 89121a7 commit cb883f9
Show file tree
Hide file tree
Showing 4 changed files with 373 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FingerprintApi* | [**getEvent**](docs/Api/FingerprintApi.md#getevent) | **GET** /events/{request_id} | Get event by request ID
*FingerprintApi* | [**getVisits**](docs/Api/FingerprintApi.md#getvisits) | **GET** /visitors/{visitor_id} | Get visits by visitor ID
*FingerprintApi* | [**updateEvent**](docs/Api/FingerprintApi.md#updateevent) | **PUT** /events/{request_id} | Update an event with a given request ID

## Documentation for Models

Expand Down
64 changes: 64 additions & 0 deletions docs/Api/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**getEvent**](FingerprintApi.md#getEvent) | **GET** /events/{request_id} | Get event by request ID
[**getVisits**](FingerprintApi.md#getVisits) | **GET** /visitors/{visitor_id} | Get visits by visitor ID
[**updateEvent**](FingerprintApi.md#updateEvent) | **PUT** /events/{request_id} | Update an event with a given request ID

# **getEvent**
> [ \Fingerprint\ServerAPI\Model\EventResponse, \Psr\Http\Message\ResponseInterface ] getEvent($request_id)
Expand Down Expand Up @@ -141,3 +142,66 @@ Array:

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **updateEvent**
> updateEvent($body, $request_id)
Update an event with a given request ID

Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days.

### Example
```php
<?php

require_once(__DIR__ . '/vendor/autoload.php');

const FPJS_API_SECRET = "Your Fingerprint Secret API Key"; // Fingerprint Secret API Key

// Import Fingerprint Classes and Guzzle HTTP Client
use Fingerprint\ServerAPI\Api\FingerprintApi;
use Fingerprint\ServerAPI\Configuration;
use GuzzleHttp\Client;

// Create new Configuration instance with defaultValues, added our API Secret and our Region
$config = Configuration::getDefaultConfiguration(FPJS_API_SECRET, Configuration::REGION_EUROPE);
$client = new FingerprintApi(
new Client(),
$config
);

$body = new \Fingerprint\ServerAPI\Model\EventUpdateRequest(); // \Fingerprint\ServerAPI\Model\EventUpdateRequest |
$request_id = "request_id_example"; // string | The unique event [identifier](https://dev.fingerprint.com/docs/js-agent#requestid).

try {
$client->updateEvent($body, $request_id);
} catch (Exception $e) {
echo 'Exception when calling FingerprintApi->updateEvent: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**\Fingerprint\ServerAPI\Model\EventUpdateRequest**](../Model/EventUpdateRequest.md)| |
**request_id** | **string**| The unique event [identifier](https://dev.fingerprint.com/docs/js-agent#requestid). |

### Return type

Array:
0. null,
1. \Psr\Http\Message\ResponseInterface


### Authorization

[ApiKeyHeader](../../README.md#ApiKeyHeader), [ApiKeyQuery](../../README.md#ApiKeyQuery)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

59 changes: 59 additions & 0 deletions res/fingerprint-server-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,65 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorEvent404Response'
put:
tags:
- Fingerprint
operationId: updateEvent
summary: Update an event with a given request ID
description: >
Change information in existing events specified by `requestId` or *flag
suspicious events*.
When an event is created, it is assigned `linkedId` and `tag` submitted
through the JS agent parameters. This information might not be available
on the client so the Server API allows for updating the attributes after
the fact.
**Warning** It's not possible to update events older than 10 days.
parameters:
- name: request_id
in: path
description: >-
The unique event
[identifier](https://dev.fingerprint.com/docs/js-agent#requestid).
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EventUpdateRequest'
responses:
'200':
description: OK
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorUpdateEvent400Response'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorCommon403Response'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEvent404Response'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorUpdateEvent409Response'
/visitors/{visitor_id}:
get:
tags:
Expand Down
Loading

0 comments on commit cb883f9

Please sign in to comment.