Skip to main content

XM Discover API: Import API Multiple Records Usage Example

Note: We strongly recommend using XM Discover Link connector instead of the Import API.

Let's upload three records and save them in XM Discover.

Sample Request (Body)​

{
    "process": true,
    "save": true,
    "stage" : false,
    "projectName": "Hotel Surveys",
    "modelName": "Lodging",
    "attributes": [{
        "name": "SOURCE",
        "type": "TEXT",
        "map": "SOURCE",
        "display": "SOURCE",
        "defaultValue": "hotelReviewsCom",
        "isReportable": true
    },{
        "name": "RESPONSE",
        "type": "TEXT",
        "map": "VERBATIM",
        "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": "111",
            "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-01"
        },
        {
            "NATURAL_ID": "222",
            "AUTHOR": "A HotelReviewsCom Member",
            "RESPONSE": "If the rooms of this hotel facing the street were any louder - I would have felt like I was camping out on the highway. Didn't sleep a wink the whole night. Missed my meeting the next morning. Ugh!",
            "SOURCE": "hotelReviewsCom",
            "DOCUMENT_DATE": "2017-03-02"
        },
        {
            "NATURAL_ID": "333",
            "AUTHOR": "Fififlores",
            "RESPONSE": "Found a large dead cricket on the floor of the bathroom but other than that and the alarm clock problem - we did not realize it was set to go off at 7:00 and fumbled 3 times to turn it off, we had a fun time!",
            "SOURCE": "hotelReviewsCom",
            "DOCUMENT_DATE": "2017-03-03"
        }],
    "creditsExceededAction": "WARN",
    "runClassification": true,
    "allIncrementalModels": false
}

Sample Response​

Since we have uploaded more than one record, the response is limited to status, session ID, and model names.

{
    "session": 4559152,
    "status": "SUCCESS",
    "models": [
        {
            "name": "Lodging"
        }
    ],
    "problem": []
}