Jump to content
X2Community Forums

mfoote

core_group_3
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

2 Neutral

About mfoote

  • Rank
    Newbie
  1. Fixed! <?php$username = "admin";$password = "<userKey>";$contact = array( "firstName" => "Walt", "lastName" => "White", "email" => "walter.white@sandia.gov", "visibility" => 1);$ch = curl_init();curl_setopt($ch, CURLOPT_URL,"http://mydomain.com/index.php/api2/Contacts");curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json; charset=utf-8;")); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); $data = json_encode ($contact);curl_setopt($ch, CURLOPT_POST, $data);curl_setopt($ch,
  2. Maybe you already figured this out but http://wiki.x2engine.com/wiki/REST_API_Referencedo a find on 415 I used the following and that error went away for me: curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json; charset=utf-8;"));
  3. I'm new to the community so I'm probably missing something basic. Any help would be great. I'm trying to create a new contact using a basic php page with hard coded data. I'm getting back 'Missing or malformed data sent to server.' but I have no idea what the server doesn't like. {"httpHeaders":{"Content-Type":"application\/json; charset=utf-8"},"message":"Missing or malformed data sent to server.","error":true,"status":400} I've attached the full contents of my php file: <?php $username = "admin";$password = "9...Q";$contact = array( "firstName" => "Walt",
×
×
  • Create New...