<!-- Intent: create a new contact list --> <?php $url = 'http://api.v4.swiftreach.com/api/ContactLists/Create'; $authToken = '123456'; $jsonString = ' { "ListName":"Peter Test", "ListType":0, "Description":"Peter Test", "ExposeHomePortal":false, "ExposeVisitorPortal":false, "DeleteLocked":false, "SubscriptionRequiresApproval":false, "PendingApprovalCount":0 }'; $headers = array( 'Content-type: application/json', 'SwiftAPI-Key: ' . $authToken, 'Accept: application/json', 'Expect:' ); $ch = curl_init(); $args = array( CURLOPT_URL => $url, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $jsonString, CURLOPT_HTTPHEADER => $headers, ); curl_setopt_array($ch, $args); $res = curl_exec($ch); $res_data = json_decode($res, true); print($res_data); ?> <!-- example return value --> 123456