▪ Fragments
Content Fragments API returns a list of content fragments relative to a POI.
A content fragment is a piece of content left by a user which is extracted according to criteria of meaningfulness, relevance, synthesis and self-consistency.
Request
Endpoint
GET
/v4/{billing_plan}/account/{account_id}/poi/{poi_id}/contents/fragments
Path Parameters
Name | Description | Type | Examples |
---|---|---|---|
*{billing_plan} | Billing plan to be applied to the call. | string | licence ondemand |
*{account_id} | Provided identifier of the account. | string | |
*{poi_id} | Identifier of the POI to retrieve data for. Value obtainable either : - if {billing_plan} = licence, from $.results[*].resource.id field of List Licences Response Body- if {billing_plan} = ondemand, from $.results.pois[*].id field of any Search API Response Body. |
string | XXeUNbmtYZTsH7UGvNfXWo |
Header Parameters
Name | Description | Type | Examples |
---|---|---|---|
*x-api-key | Provided API key {x_api_key} that allows authentication. |
string | |
*Authorization | Provided token {jwt_bearer} that allows authorization. |
string | Bearer {jwt_bearer} |
Query Parameters
Name | Description | Type | Examples | Default |
---|---|---|---|---|
*from | Start date of timeframe. | date | 2020-01-01 | |
*to | End date of timeframe. | date | 2020-12-31 | |
sentiment.value.eq | Filter by sentiment equal to the specified value. | decimal | ||
sentiment.value.gt | Filter by sentiment greater than the specified value. | decimal | ||
sentiment.value.gte | Filter by sentiment greater than or equal to the specified value. | decimal | ||
sentiment.value.lt | Filter by sentiment less than the specified value. | decimal | ||
sentiment.value.lte | Filter by sentiment less than or equal to the specified value. | decimal | ||
rating.value.eq | Filter by rating value (based on network rating) equal to the specified value. | decimal | ||
rating.value.gt | Filter by rating value (based on network rating) greater than the specified value. | decimal | ||
rating.value.gte | Filter by rating value (based on network rating) greater than or equal to the specified value. | decimal | ||
rating.value.lt | Filter by rating value (based on network rating) less than the specified value. | decimal | ||
rating.value.lte | Filter by rating value (based on network rating) less than or equal to the specified value. | decimal | ||
rating.percent.eq | Filter by percentage-based rating equal to the specified value. | decimal | ||
rating.percent.gt | Filter by percentage-based rating greater than the specified value. | decimal | ||
rating.percent.gte | Filter by percentage-based rating greater than or equal to the specified value. | decimal | ||
rating.percent.lt | Filter by percentage-based rating less than the specified value. | decimal | ||
rating.percent.lte | Filter by percentage-based rating less than or equal to the specified value. | decimal | ||
reply_received | Filter by contents with a reply. | boolean | truefalse | |
ⓝ network | Filter by network. | string | Dictionary | |
ⓝ user_country | Filter by reviewer's country of origin in ISO 3166-1 alpha-2 standard format (in lower case). | string | itde | |
ⓝ content_language | Filter by contents language in ISO_639-1 standard format. | string | enfr | |
ⓝ user_type | Filter by user type. | string | Dictionary | |
ⓝ content_type | Filter by type of content. | string | postreviewtaggedpost | |
② order_by | Order results by specifying: ±{order_value}Results in ascending order: {order_value} or +{order_value}Results in descending order: -{order_value} | string | sentiment-date | |
page | Requested page number for paginated results. | int | 1 | |
page_size | Requested page size for paginated results in the range [1, 100]. | int | 25 |
Supported values for content_type
- review
- post
- taggedpost
Supported values for {order_by}
- sentiment, +sentiment, -sentiment
- date, +date, -date
Example
curl -X GET 'https://api.datappeal.io/v4/licence/account/{account_id}/poi/6PGrDFX8rCDsDPzEr17uHq/contents/fragments?from=2020-01-01&to=2020-02-29&page_size=2' \
-H 'x-api-key: {x_api_key}' \
-H 'Authorization: Bearer {jwt_bearer}' \
Response
Status
Status | Description |
---|---|
200 | Contents Fragments data has been successfully returned. |
Body
ContentsFragments
Field | Description | Type |
---|---|---|
*results | Paginated list of contents fragments. | array[ContentFragment] |
paging | Response pagination. | Paging |
ContentFragment
Field | Description | Type | Examples |
---|---|---|---|
*id | Identifier of the content fragment. | string | 89703872958 |
*type | Identifies the type of the content the fragment is extracted from. | string | post review taggedpost |
*date | Date on which the content was left by the user. | date | 2020-02-24 |
*details | Additional information concerning the content fragment. | ContentFragmentDetails | |
*network | Descriptive identifier of the network the fragment is extracted from. | string | Dictionary |
*text | The extracted content fragment text. | string | Morning Breakfast was excellent. |
*link | URL to the web page containing the content the fragment is extracted from. | string | https://www.booking.com/reviews/it/hotel/plazalucchesifirenze/review/8cdcaa4b86944c8e.it.html |
ContentFragmentDetails
Field | Description | Type | Examples |
---|---|---|---|
*highlights | Topic highlights of content fragment. | array[ContentFragmentTopicHighlight] | |
*language | Language of the content fragment. | string | en fr |
ContentFragmentTopicHighlight
Field | Description | Type | Examples |
---|---|---|---|
*start | Start index of the topic occurrence within the string of parent's ContentFragment.text field. |
int | 8 |
*type | Opinion polarity expressed on the topic occurrence. | string | positive negative |
*end | End index of the topic occurrence within the string of parent's ContentFragment.text field. |
int | 16 |
Paging
Field | Description | Type |
---|---|---|
last | A relative URI to the last page. | string |
first | A relative URI to the first page. | string |
prev | A relative URI to the previous page. | string |
next | A relative URI to the next page. | string |
current | A relative URI to the current page. | string |
pages | A set of relative URIs calculated around the current page. | Page |
elements | All indexes shown on the current page. | array[int] |
total | The number of all elements that API can retrieve. | int |
size | The selected page size. | int |
Page
Field | Description | Type |
---|---|---|
number | Number of the page. | int |
uri | URI of the page. | string |
Example
{
"results": [
{
"id": "92105658361",
"type": "review",
"date": "2020-01-15",
"details": {
"highlights": [
{
"start": 50,
"type": "positive",
"end": 53
}
],
"language": "en"
},
"network": "booking",
"text": "A real disappointment to an otherwise delightful stay.\nI’ve altered my 5 stars to a 1 star unfortunately.",
"link": "https://www.booking.com/reviews/it/hotel/plazalucchesifirenze/review/8cdcaa4b86944c8e.it.html"
},
{
"id": "92105501271",
"type": "review",
"date": "2020-01-02",
"details": {
"highlights": [
{
"start": 16,
"type": "positive",
"end": 20
}
],
"language": "en"
},
"network": "tripadvisor",
"text": "Great staff and rooms very helpful",
"link": "https://www.tripadvisor.it/ShowUserReviews-g255068-d256687-r836903476-Stamford_Plaza_Brisbane-Brisbane_Brisbane_Region_Queensland.html"
}
],
"paging": {
"last": "/contents/fragment?page=159&page_size=2&from=2020-01-01&to=2020-02-29",
"first": "/contents/fragment?page=1&page_size=2&from=2020-01-01&to=2020-02-29",
"prev": null,
"next": "/contents/fragment?page=2&page_size=2&from=2020-01-01&to=2020-02-29",
"current": "/contents/fragment?page=1&page_size=2&from=2020-01-01&to=2020-02-29",
"pages": [
{
"number": 1,
"uri": "/contents/fragment?page=1&page_size=2&from=2020-01-01&to=2020-02-29"
},
{
"number": 2,
"uri": "/contents/fragment?page=2&page_size=2&from=2020-01-01&to=2020-02-29"
},
{
"number": 3,
"uri": "/contents/fragment?page=3&page_size=2&from=2020-01-01&to=2020-02-29"
},
{
"number": 4,
"uri": "/contents/fragment?page=4&page_size=2&from=2020-01-01&to=2020-02-29"
},
{
"number": 5,
"uri": "/contents/fragment?page=5&page_size=2&from=2020-01-01&to=2020-02-29"
}
],
"elements": [
1,
2
],
"total": 317,
"size": 2
}
}