How to create a new contact in a specific list
Initially you have to create a List, if you don' t have one. Use the following command:
curl https://{domain}/api/cm/lists -d '{"name": "list1", "description": "A brief description of my list"}' -H "Content-Type: application/json" -v -u {name}:{password} -X POST
In case of successful creation, you will get a response similar to this:
{
"id": 12,
"name": "list1",
"description": "A brief description of my list",
"updatedAt": "2017-07-13T15:42:06Z",
"createdAt": "2017-07-13T15:42:06Z"
}
A this point you can use the contact creation API and the id of the list you just created (or the id of one of your already existing lists) to create the new contact:
curl https://{domain}/api/cm/contacts -d '{"firstName": "John", "lastName": "doe", "phone": "1234567890", "ListId": 12}' -v -u {name}:{password} -X POST
In case you have some custom fields in the list and wants to populate them, you can assign the value using the sintax "cf_{your customfield id}":
curl https://{domain}/api/cm/contacts -d '{"firstName": "John", "lastName": "doe", "phone": "1234567890", "ListId": 12, "cf_1": "some text", "cf_3": "some other text"}' -v -u {name}:{password} -X POST