06. Contact import

NB: After 24 hours from initial creation the data will be deleted. 

POST /import.{format}

Initialize import job

curl 'http://api.linkmobility.dk/v2/import.json?apikey=[apikey]' -X POST -H "Content-Type: application/json" -d @file.json
curl 'http://api.linkmobility.dk/v2/import.xml?apikey=[apikey]' -X POST -H "Content-Type: text/xml" -d @file.xml

Fields

Name

Type

Description

listid

integer

If you wan't to import into an existing list, add the listid

name

String

Name to use for new list, only used if no listid is set

clean

Boolean (1 = delete, 0 = keep)

Should all contacts in the list be deleted before import

duplicate

Boolean (1 = delete, 0 = keep)

Should duplicate numbers be deleted

payload

file.json

{
    "import": {
        "listid": 33,
        "name": "TEST",
        "clean": 0,
        "duplicate": 0
    }
}

response

{
    "import": {
        "hash": "1fa97e90d173a9ed979bec56f3cef0f1d5c2f3fbf33e263dcbae28c9bd006abe",
        "created": "2014-12-17 15:24:57",
        "listid": 0,
        "name": "TEST",
        "clean": 0,
        "total": 0,
        "processed": 0
    },
    "status": 201
}

PUT /import/{hash}.{format}

List of numbers to import

Uses {hash} from POST

curl 'http://api.linkmobility.dk/v2/import/{hash}.json?apikey=[apikey]' -X PUT -H "Content-Type: application/json" -d @file.json
curl 'http://api.linkmobility.dk/v2/import/{hash}.xml?apikey=[apikey]' -X PUT -H "Content-Type: text/xml" -d @file.xml

payload

file.json

{
    "import": {
        "keys": [
            "Mobile",
            "Fornavn",
            "Efternavn"
        ],
        "values": [
            [
                "+4512345678",
                "Jack",
                "Bauer"
            ],
            [
                "+4587654321",
                "Chuck",
                "Norris"
            ]
        ]
    }
}

response

{
    "import": {
        "hash": "792d979f57f8f046ba3c5d73353be07d4fa06a9cfbe491f044be1d357f63756c",
        "created": "2014-12-17 15:54:01",
        "listid": 1,
        "name": "TEST",
        "clean": 0,
        "duplicate": 1,
        "total": 3,
        "processed": 3
    },
    "errors": [
        {
            "message": "Mobile is not valid! Remember a valid number must contain a countrycode like +4512345678",
            "count": 1,
            "errors": {
                "1": "4587654321"
            }
        }
    ],
    "status": 200
}

GET /import/{hash}.{format}

Get status on import

curl 'http://api.linkmobility.dk/v2/import/{hash}.json?apikey=[apikey]' -X GET
curl 'http://api.linkmobility.dk/v2/import/{hash}.xml?apikey=[apikey]' -X GET
{
    "import": {
        "hash": "1fa97e90d173a9ed979bec56f3cef0f1d5c2f3fbf33e263dcbae28c9bd006abe",
        "created": "2014-12-17 15:24:57",
        "listid": 0,
        "name": "TEST",
        "clean": 0,
        "total": 100,
        "processed": 100
    },
    "status": 200
}

Feeling lost? Click on this link! Portal page