05. Contacts
GET /contacts/{page}.{format}
Get all contacts based on search params
curl 'http://api.linkmobility.dk/v2/contacts/1.json?apikey=[apikey]' -X GET curl 'http://api.linkmobility.dk/v2/contacts/1.xml?apikey=[apikey]' -X GET
Fields
You can use the following GET parameter when searching for contacts
Name | Type | Description |
---|---|---|
listid | String | Search for contacts in a specific list |
mobile | String | Search for contacts with a specific mobile number |
deleted | Boolean | Search for contacts that are deleted or active |
field_key | String | Search merge field key |
field_value | String | Search merge field value |
response
{ "contacts": [ { "id": "631809", "listid": "373", "mobile": "+4512721272", "created": "2015-03-13 09:11:22", "changed": "2015-03-13 09:11:22", "deleted": false, "fields": { "Fornavn": "TEST", "Efternavn": "" } }, { "id": "632065", "listid": "373", "mobile": "+4512721272", "created": "2015-03-13 09:11:22", "changed": "2015-03-13 09:11:22", "deleted": false, "fields": { "Fornavn": "TEST", "Efternavn": "" } } ], "paging": { "pages": 81056, "offset": 2, "current": 1 }, "stats":{ "total":"2", }, "status": 200 }
GET /contact/{id}.{format}
Get one contact by id
curl 'http://api.linkmobility.dk/v2/contact/{id}.json?apikey=[apikey]' -X GET curl 'http://api.linkmobility.dk/v2/contact/{id}.xml?apikey=[apikey]' -X GET
{ "contact": { "id": "85", "listid": "9", "mobile": "+4512345678", "created": "2014-12-15 13:51:26", "changed": "2014-12-15 13:51:26", "fields": { "Fornavn": "Jack", "Efternavn": "Bauer" } }, "status": 200 }
POST /contact.{format}
Create new contact
curl 'http://api.linkmobility.dk/v2/contact.json?apikey=[apikey]' -X POST -H "Content-Type: application/json" -d @file.json curl 'http://api.linkmobility.dk/v2/contact.xml?apikey=[apikey]' -X POST -H "Content-Type: text/xml" -d @file.xml
payload
file.json
{ "contact": { "listid": "33", "mobile": "+4512345678", "fields": { "Fornavn": "Jack", "Efternavn": "Bauer" } } }
file.xml
<?xml version="1.0"?> <contact> <listid>33</listid> <mobile>+4512345678</mobile> <fields> <Fornavn>Jack</Fornavn> <Efternavn>Bauer</Efternavn> </fields> </contact>
response
{ "contact": { "id": "109", "listid": "33", "mobile": "+4512345678", "created": "2014-12-17 08:32:31", "changed": "2014-12-17 08:32:31", "fields": { "Fornavn": "Jack", "Efternavn": "Bauer" } }, "status": 201 }
<?xml version="1.0"?> <response> <contact> <id>113</id> <listid>33</listid> <mobile>+4512345678</mobile> <created>2014-12-17 08:32:51</created> <changed>2014-12-17 08:32:51</changed> <fields> <Fornavn>Jack</Fornavn> <Efternavn>Bauer</Efternavn> </fields> </contact> <status>201</status> </response>
PUT /contact/{id}.{format}
Update existing contact
curl 'http://api.linkmobility.dk/v2/contact/{id}.json?apikey=[apikey]' -X PUT -H "Content-Type: application/json" -d @file.json curl 'http://api.linkmobility.dk/v2/contact/{id}.xml?apikey=[apikey]' -X PUT -H "Content-Type: text/xml" -d @file.xml
payload
file.json
{ "contact": { "listid": "33", "mobile": "+4512345678", "fields": { "Fornavn": "Anders", "Efternavn": "And" } } }
file.xml
<?xml version="1.0"?> <contact> <listid>33</listid> <mobile>+4512345678</mobile> <fields> <Fornavn>Anders</Fornavn> <Efternavn>And</Efternavn> </fields> </contact>
response
{ "contact": { "id": "109", "listid": "33", "mobile": "+4512345678", "created": "2014-12-17 08:32:31", "changed": "2014-12-17 08:32:31", "fields": { "Fornavn": "Anders", "Efternavn": "And" } }, "status": 201 }
<?xml version="1.0"?> <response> <contact> <id>113</id> <listid>33</listid> <mobile>+4512345678</mobile> <created>2014-12-17 08:32:51</created> <changed>2014-12-17 08:32:51</changed> <fields> <Fornavn>Anders</Fornavn> <Efternavn>And</Efternavn> </fields> </contact> <status>201</status> </response>
DELETE /contact/{id}.{format}
Delete a specific contact by id
curl 'http://api.linkmobility.dk/v2/contact/{id}.json?apikey=[apikey]' -X DELETE curl 'http://api.linkmobility.dk/v2/contact/{id}.xml?apikey=[apikey]' -X DELETE
{ "message": "Contact id [113] deleted", "status": 200 }
{ "status": 404, "message": "Contact id [113] not found" }
Feeling lost? Click on this link! Portal page