XM Discover API: Import API Single Record Usage Example
Note: We strongly recommend using XM Discover Link connector instead of the Import API.
Let's upload a single record and save it in XM Discover.
Sample Request (Body)
{
"responseLevel": "FULL",
"save": true,
"process": true,
"stage": false,
"projectName": "Hotel Surveys",
"modelName": "Lodging",
"duplicateDetection": "REJECT_DUPLICATES",
"attributes": [{
"name": "SOURCE",
"type": "TEXT",
"map": "SOURCE",
"display": "SOURCE",
"defaultValue": "hotelReviewsCom",
"isReportable": true
},{
"name": "RESPONSE",
"type": "TEXT",
"map": "VERBATIM",
"parameters": {
"language": "en"},
"display": "RESPONSE",
"defaultValue": null,
"isReportable": true
},{
"name": "NATURAL_ID",
"type": "NUMBER",
"map": "ID1",
"display": "NATURAL_ID",
"defaultValue": null,
"isReportable": true
},
{
"name": "DOCUMENT_DATE",
"type": "DATE",
"map": "DOC_DATE",
"display": "DOCUMENT_DATE",
"defaultValue": null,
"isReportable": true
},
{
"name": "AUTHOR",
"type": "TEXT",
"map": "STRUCT",
"display": "AUTHOR",
"defaultValue": null,
"isReportable": true
}],
"records": [
{
"NATURAL_ID": "1111",
"AUTHOR": "John Smith",
"RESPONSE": "Breakfast was mediocre and overpriced. The real bothersome part of our stay was the low water pressure in the shower and a very old showerhead.",
"SOURCE": "hotelReviewsCom",
"DOCUMENT_DATE": "2017-03-30"
}
],
"creditsExceededAction": "WARN",
"limitByWordRank": false,
"includeNRelations": false,
"includeWorldAwareness": true
}
Sample Response (Full)
Since we have set the response level to FULL in our request, the Import API returns verbatim, sentence, and linguistic details.
{
"attributes": {
"attributeValues": [
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "1"
},
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "2"
},
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "20"
},
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "5"
},
{
"attributeName": "cb_document_word_count",
"attributeValue": "25"
}
]
},
"categories": {
"category": [
{
"name": "Price/Cost & Value",
"id": 4550037,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Bathroom/Bathroom Decor/Design",
"id": 4549360,
"score": 200,
"degreeSentiment": -2
},
{
"name": "Bathroom",
"id": 4549343,
"score": 200,
"degreeSentiment": -2
},
{
"name": "Breakfast",
"id": 4549454,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Breakfast/Cost",
"id": 4549464,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Price",
"id": 4550027,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Bathroom/Water Pressure & Temp",
"id": 4549386,
"score": 200,
"degreeSentiment": -2
}
]
},
"status": "SUCCESS",
"problem": null,
"verbatimSet": {
"verbatim": [
{
"type": "RESPONSE",
"categories": {
"category": [
{
"name": "Price/Cost & Value",
"id": 4550037,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Bathroom/Bathroom Decor/Design",
"id": 4549360,
"score": 200,
"degreeSentiment": -2
},
{
"name": "Bathroom",
"id": 4549343,
"score": 200,
"degreeSentiment": -2
},
{
"name": "Breakfast",
"id": 4549454,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Breakfast/Cost",
"id": 4549464,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Price",
"id": 4550027,
"score": 200,
"degreeSentiment": -2.25
},
{
"name": "Bathroom/Water Pressure & Temp",
"id": 4549386,
"score": 200,
"degreeSentiment": -2
}
]
},
"degreeSentiment": -2.13,
"sentences": {
"sentence": [
{
"categories": {
"category": [
{
"name": "Price/Cost & Value",
"id": 4550037,
"score": 200
},
{
"name": "Breakfast",
"id": 4549454,
"score": 200
},
{
"name": "Breakfast/Cost",
"id": 4549464,
"score": 200
},
{
"name": "Price",
"id": 4550027,
"score": 200
}
]
},
"degreeSentiment": -2.25,
"start": 0,
"end": 38,
"text": "Breakfast was mediocre and overpriced.",
"tokens": {
"token": [
{
"name": "Breakfast",
"normalForm": "BREAKFAST",
"start": 0,
"end": 9,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "was",
"normalForm": "BE",
"start": 10,
"end": 13,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "mediocre",
"normalForm": "MEDIOCRE",
"start": 14,
"end": 22,
"sentiment": -1,
"negation": 0,
"degreeSentiment": -1,
"type": null
},
{
"name": "and",
"normalForm": "AND",
"start": 23,
"end": 26,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "overpriced",
"normalForm": "OVERPRICE",
"start": 27,
"end": 37,
"sentiment": -2,
"negation": 0,
"degreeSentiment": -2,
"type": null
}
]
},
"relationships": {
"relationship": [
{
"source": "BE",
"target": "BREAKFAST",
"masterRelationship": "BE -> BREAKFAST"
},
{
"source": "BE",
"target": "MEDIOCRE",
"masterRelationship": "BE -> MEDIOCRE"
},
{
"source": "BE",
"target": "OVERPRICE",
"masterRelationship": "BE -> OVERPRICE"
},
{
"source": "MEDIOCRE",
"target": "AND",
"masterRelationship": "MEDIOCRE -> AND"
},
{
"source": "BREAKFAST",
"target": "MEDIOCRE",
"masterRelationship": "BREAKFAST -> MEDIOCRE"
},
{
"source": "BREAKFAST",
"target": "OVERPRICE",
"masterRelationship": "BREAKFAST -> OVERPRICE"
}
]
},
"nRelationships": null,
"attributes": {
"attributeValues": [
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "5"
},
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "1"
}
]
}
},
{
"categories": {
"category": [
{
"name": "Bathroom/Bathroom Decor/Design",
"id": 4549360,
"score": 200
},
{
"name": "Bathroom",
"id": 4549343,
"score": 200
},
{
"name": "Bathroom/Water Pressure & Temp",
"id": 4549386,
"score": 200
}
]
},
"degreeSentiment": -2,
"start": 39,
"end": 143,
"text": "The real bothersome part of our stay was the low water pressure in the shower and a very old showerhead.",
"tokens": {
"token": [
{
"name": "real",
"normalForm": "REAL",
"start": 4,
"end": 8,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "bothersome",
"normalForm": "BOTHERSOME",
"start": 9,
"end": 19,
"sentiment": -2,
"negation": 0,
"degreeSentiment": -2,
"type": null
},
{
"name": "part",
"normalForm": "PART",
"start": 20,
"end": 24,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "of",
"normalForm": "OF",
"start": 25,
"end": 27,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "our",
"normalForm": "OUR",
"start": 28,
"end": 31,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "stay",
"normalForm": "STAY",
"start": 32,
"end": 36,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "was",
"normalForm": "BE",
"start": 37,
"end": 40,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "low",
"normalForm": "LOW",
"start": 45,
"end": 48,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "water",
"normalForm": "WATER",
"start": 49,
"end": 54,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "pressure",
"normalForm": "PRESSURE",
"start": 55,
"end": 63,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "in",
"normalForm": "IN",
"start": 64,
"end": 66,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "shower",
"normalForm": "SHOWER",
"start": 71,
"end": 77,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "and",
"normalForm": "AND",
"start": 78,
"end": 81,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "very",
"normalForm": "VERY",
"start": 84,
"end": 88,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "old",
"normalForm": "OLD",
"start": 89,
"end": 92,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
},
{
"name": "showerhead",
"normalForm": "SHOWERHEAD",
"start": 93,
"end": 103,
"sentiment": 0,
"negation": 0,
"degreeSentiment": 0,
"type": null
}
]
},
"relationships": {
"relationship": [
{
"source": "BE",
"target": "SHOWER",
"masterRelationship": "BE -> SHOWER"
},
{
"source": "BE",
"target": "PART",
"masterRelationship": "BE -> PART"
},
{
"source": "PART",
"target": "STAY",
"masterRelationship": "PART -> STAY"
},
{
"source": "PART",
"target": "REAL",
"masterRelationship": "PART -> REAL"
},
{
"source": "PART",
"target": "BOTHERSOME",
"masterRelationship": "PART -> BOTHERSOME"
},
{
"source": "STAY",
"target": "OF",
"masterRelationship": "STAY -> OF"
},
{
"source": "STAY",
"target": "OUR",
"masterRelationship": "STAY -> OUR"
},
{
"source": "BE",
"target": "PRESSURE",
"masterRelationship": "BE -> PRESSURE"
},
{
"source": "PRESSURE",
"target": "LOW",
"masterRelationship": "PRESSURE -> LOW"
},
{
"source": "PRESSURE",
"target": "WATER",
"masterRelationship": "PRESSURE -> WATER"
},
{
"source": "SHOWER",
"target": "IN",
"masterRelationship": "SHOWER -> IN"
},
{
"source": "OLD",
"target": "VERY",
"masterRelationship": "OLD -> VERY"
},
{
"source": "SHOWERHEAD",
"target": "OLD",
"masterRelationship": "SHOWERHEAD -> OLD"
},
{
"source": "BE",
"target": "SHOWERHEAD",
"masterRelationship": "BE -> SHOWERHEAD"
},
{
"source": "SHOWER",
"target": "AND",
"masterRelationship": "SHOWER -> AND"
},
{
"source": "PART",
"target": "PRESSURE",
"masterRelationship": "PART -> PRESSURE"
}
]
},
"nRelationships": null,
"attributes": {
"attributeValues": [
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "2"
},
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "20"
}
]
}
}
]
},
"attributes": {
"attributeValues": [
{
"attributeName": "_language",
"attributeValue": "English"
},
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "1"
},
{
"attributeName": "cb_sentence_quartile",
"attributeValue": "2"
},
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "20"
},
{
"attributeName": "cb_sentence_word_count",
"attributeValue": "5"
}
]
},
"incrementalCategories": null
}
]
},
"degreeSentiment": -2.13,
"incrementalCategories": null
}