-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
469 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
![LUX](/Documentation/Images/logo_claim.svg#gh-light-mode-only "LUX") | ||
![LUX](/Documentation/Images/logo_claim_white.svg#gh-dark-mode-only "LUX") | ||
|
||
# Endpoint "create" to write new or update existing leads into database (writing access) | ||
|
||
*Note:* This endpoint was introduced with LUXenterprise 38.0.0 and is not available before this version | ||
|
||
The endpoint `create` can be used to add new visitor objects to LUX. | ||
|
||
*Note:* If you pass an email address and there is already a visitor with same mail existing, both visitor objects are | ||
going to be merged to keep history by default | ||
|
||
## 1. Usage | ||
|
||
A new lead with two attributes is created from API with one pagevisit and with a fingerprint record can be added via | ||
API with these arguments: | ||
|
||
``` | ||
{ | ||
"endpoint": "create", | ||
"properties": { | ||
"visitor": { | ||
"email": "new@email.org", | ||
"ipAddress": "127.0.0.1", | ||
"identified": "1", | ||
"scoring": "10", | ||
"visits": "1", | ||
"attributes": { | ||
"0": { | ||
"name": "firstname", | ||
"value": "Alex" | ||
}, | ||
"1": { | ||
"name": "lastname", | ||
"value": "Kellner" | ||
} | ||
}, | ||
"pagevisits": { | ||
"0": { | ||
"page": "12", | ||
"language": "0", | ||
"referrer": "https://lastdomain.org/page" | ||
} | ||
}, | ||
"fingerprints": { | ||
"0": { | ||
"value": "abcdef123456789foobar", | ||
"domain": "mydomain.org", | ||
"userAgent": "Mozilla/5.0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
CURL example: | ||
|
||
``` | ||
curl -k -d 'tx_luxenterprise_api[arguments]={"endpoint":"create","properties":{"visitor":{"email":"new@email.org","ipAddress":"127.0.0.1","identified":"1","scoring":"10","visits":"1",attributes":{"0":{"name":"firstname","value":"Alex"},"1":{"name":"lastname","value":"Kellner"}},"pagevisits":{"0":{"page":"12","language":"0","referrer":"https://lastdomain.org/page"}},"fingerprints":{"0":{"value":"abcdef123456789foobar","domain":"mydomain.org","userAgent":"Mozilla/5.0"}}}}}' -H 'Api-Key: abc...' --url https://www.in2code.de/luxenterprise_api.json | ||
``` | ||
|
||
|
||
## 2. Merge by Fingerprint | ||
|
||
If you want to update an existing lead by its fingerprint, this example will help you out. In the following case we | ||
want to add the attribute "newsletter" with value 1 for a possible newsletter registration. | ||
|
||
``` | ||
{ | ||
"endpoint": "create", | ||
"merge": { | ||
"mergeByEmail": 0, | ||
"mergeByFingerprint": 1 | ||
}, | ||
"properties": { | ||
"visitor": { | ||
"attributes": { | ||
"": { | ||
"name": "newsletter", | ||
"value": "1" | ||
} | ||
}, | ||
"fingerprints": { | ||
"0": { | ||
"value": "abcdef123456789foobar" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
CURL example: | ||
|
||
``` | ||
curl -k -d 'tx_luxenterprise_api[arguments]={"endpoint":"create","merge":{"mergeByEmail":0,"mergeByFingerprint":1},"properties":{"visitor":{"attributes":{"":{"name":"newsletter","value":"1"}},"fingerprints":{"0":{"value":"abcdef123456789foobar"}}}}}' -H 'Api-Key: abc...' --url https://www.in2code.de/luxenterprise_api.json | ||
``` | ||
|
||
**Note:** If you want to get the fingerprint value of the current visitor via JavaScript, following example could help: | ||
|
||
``` | ||
const lux = LuxSingleton.getInstance(); | ||
if (lux.getIdentification().isIdentificatorSet()) { | ||
const identificator = lux.getIdentification().getIdentificator(); | ||
console.log(identificator); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
![LUX](/Documentation/Images/logo_claim.svg#gh-light-mode-only "LUX") | ||
![LUX](/Documentation/Images/logo_claim_white.svg#gh-dark-mode-only "LUX") | ||
|
||
# Endpoint "findAllByAnyProperties" for getting a list of visitors (reading access) | ||
|
||
The endpoint `findAllByAnyProperties` can be used to search for all leads by given search terms. | ||
You can pass multiple arguments (also in related tables), limit and orderings. | ||
|
||
## Default arguments | ||
|
||
These arguments are used by default if not overwritten in your request: | ||
|
||
``` | ||
'endpoint' => 'findAllByAnyProperties', | ||
'properties' => [ | ||
[ | ||
'name' => 'uid', | ||
'value' => 0, | ||
'operator' => 'greaterThan' | ||
] | ||
], | ||
'limit' => 100, | ||
'depth' => 3, | ||
'orderings' => [ | ||
'uid' => 'DESC' | ||
], | ||
'defaultProperties' => [ | ||
'uid', | ||
'scoring', | ||
'email', | ||
'email', | ||
'identified', | ||
'visits', | ||
'blacklisted', | ||
'attributes', | ||
] | ||
``` | ||
|
||
## Example usage | ||
|
||
In the example below, a search is triggered `where tx_lux_domain_model_visitor.email like %in2code.de` with these | ||
arguments: | ||
|
||
``` | ||
{ | ||
"endpoint": "findAllByAnyProperties", | ||
"properties": { | ||
"0": { | ||
"name": "email", | ||
"value": "%in2code.de", | ||
"operator": "like" | ||
} | ||
}, | ||
"limit": 2, | ||
"depth": 2 | ||
} | ||
``` | ||
|
||
CURL example: | ||
|
||
``` | ||
curl -d 'tx_luxenterprise_api[arguments]={"endpoint":"findAllByAnyProperties","properties":{"0":{"name":"email","value":"%in2code.de","operator":"like"}},"limit":2,"depth":2}' -H 'Api-Key: abc...' --url https://www.in2code.de/luxenterprise_api.json | ||
``` | ||
|
||
Example result: | ||
|
||
``` | ||
{ | ||
"arguments": { | ||
"endpoint": "findAllByAnyProperties", | ||
"properties": [ | ||
{ | ||
"name": "email", | ||
"value": "%in2code.de", | ||
"operator": "like" | ||
} | ||
], | ||
"limit": 2, | ||
"depth": 2, | ||
"orderings": { | ||
"uid": "DESC" | ||
}, | ||
"defaultProperties": [ | ||
"uid", | ||
"scoring", | ||
"email", | ||
"email", | ||
"identified", | ||
"visits", | ||
"blacklisted", | ||
"attributes" | ||
] | ||
}, | ||
"data": [ | ||
{ | ||
"scoring": 647, | ||
"email": "alex@in2code.de", | ||
"identified": true, | ||
"visits": 13, | ||
"attributes": [ | ||
[], | ||
[] | ||
], | ||
"blacklisted": false, | ||
"uid": 18855 | ||
}, | ||
{ | ||
"scoring": 393, | ||
"email": "alexander.kellner@in2code.de", | ||
"identified": true, | ||
"visits": 10, | ||
"attributes": [ | ||
[], | ||
[] | ||
], | ||
"blacklisted": false, | ||
"uid": 18802 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
You can also search in related tables: `where tx_lux_domain_model_attribute.name = "email" and tx_lux_domain_model_attribute.value = "%in2code.de"` | ||
with these arguments: | ||
|
||
``` | ||
{ | ||
"endpoint": "findAllByAnyProperties", | ||
"properties": { | ||
"0": { | ||
"name": "attributes.name", | ||
"value": "email", | ||
"operator": "equals" | ||
}, | ||
"1": { | ||
"name": "attributes.value", | ||
"value": "%in2code.de", | ||
"operator": "like" | ||
} | ||
}, | ||
"limit": 200, | ||
"depth": 2, | ||
"orderings": { | ||
"uid": "ASC" | ||
} | ||
} | ||
``` | ||
|
||
**Note:** The attribute `email` es stored directly in visitor table but also in attribute table. A more useful query would be to search for property `newsletter` or `lastname`, etc... | ||
|
||
|
||
Another example to search for property `newsletter=1` within active users of the latest 7 days (in this documentation | ||
let's assume the unix timestamp `1650386396` is 7 days ago): | ||
|
||
``` | ||
{ | ||
"endpoint": "findAllByAnyProperties", | ||
"properties": { | ||
"0": { | ||
"name": "attributes.name", | ||
"value": "newsletter", | ||
"operator": "equals" | ||
}, | ||
"1": { | ||
"name": "attributes.value", | ||
"value": "1", | ||
"operator": "equals" | ||
}, | ||
"2": { | ||
"name": "pagevisits.crdate", | ||
"value": "1650386396", | ||
"operator": "greaterThan" | ||
} | ||
}, | ||
"limit": 200, | ||
"depth": 2, | ||
"orderings": { | ||
"pagevisits.crdate": "DESC" | ||
} | ||
} | ||
``` |
Oops, something went wrong.