Register Interaction
With the Register Interaction endpoint you can store user interactions made during a search, like clicks, feedback, etc.
https://api.ploogins.com/v1/interactions/register
Interaction Types
There are different types of interactions: click
and feedback
, which store different interaction metadata.
The Click Interaction
The click
interaction stores the plugin which has been clicked, its URL, and the type of button which has been clicked.
A metadata example would be:
{
"plugin": "modular-connector",
"url": "https://playground.wordpress.net/?plugin=modular-connector",
"click_type": "playground"
}
The Feedback Interaction
The feedback
interaction stores the rating of a user for a given performed search. It stores the user message (if provided), and if it is positive or negative.
A metadata example would be:
{
"message": "Great!",
"positive": true
}
Body Params
The parameters passed to the interactions/register
endpoint need to be encoded in a JSON format.
Name | Type | Description | Example |
---|---|---|---|
search_id* | string (UUID) | The search intent ID in which the interaction was performed | 072c2b17-4f8d-4e69-9814-5fdf598ce759 |
type* | string | The interaction type (click , feedback or plugin ) | feedback |
metadata* | JSON | The interaction metadata | {"message": "Great!", "positive": true} |
Request Example
In order to register an interaction with the Ploogins API, it is necessary to call the register endpoint using the POST method, with all required parameters.
- CURL
- Javascript
- Python
curl --location 'api.ploogins.com/v1/interactions/register' \
--header 'Authorization: Bearer YOUR-API-TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"search_id": "55253fe5-3368-4520-9b4b-86689e204204",
"type": "feedback",
"metadata": {
"message": "Good Results",
"positive": true
}
}'
const headers = new Headers();
headers.append("Authorization", "Bearer YOUR-API-TOKEN");
headers.append("Content-Type", "application/json");
const data = JSON.stringify({
"search_id": "55253fe5-3368-4520-9b4b-86689e204204",
"type": "feedback",
"metadata": {
"message": "Good Results",
"positive": true
}
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("api.ploogins.com/v1/interactions/register", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import requests
import json
url = "api.ploogins.com/v1/interactions/register"
payload = json.dumps({
"search_id": "55253fe5-3368-4520-9b4b-86689e204204",
"type": "feedback",
"metadata": {
"message": "Good Results",
"positive": True
}
})
headers = {
'Authorization': 'Bearer YOUR-API-TOKEN',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response Example
{
"interaction_id": "55259ak3-3368-4520-9b4b-86689e204204"
}