I'm new to CiviCRM and REST API Calls. I'm attempting to create a new contact using POST via Postman. I'm submitting the following:


But I get the response back:

     <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in
<b>/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php</b> on line
<br />
<?xml version="1.0"?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

I glanced at line 167 - it seems to be about constructing the response. I know I'm getting some kind of connection - If I change a character in the site or API key, I get "failed to authenticate" - so that part seems to be working.

CiviCRM version 4.7.27, Wordpress version 4.9.1

Thanks for any pointers!

  • 1
    Hi SteadH. The ':' after the json argument, Is it a typo? it should be a '='. Dec 15, 2017 at 7:26
  • Thanks! It does seem to be. I started with the correct syntax but when I received a JSON error back even though it was valid, I started experimenting!
    – SteadH
    Dec 22, 2017 at 5:36

2 Answers 2


As kainuk mentioned, you don't have the right syntax for the json field, i needs to be json= instead of json:


(it needs to be post, not get for all operations like create that modify the database)

and I would strongly recommend you to do rest over an encrypted connection (https instead of http), otherwise you risk having your keys being read by someone else than civi



I tried the same but not with Postman but with a different application outside civicrm - I managed to create a contact without any error message

so, Please try as below this should work


I guess this helps !!!

  • What other program and parameters did you use?
    – SteadH
    Dec 15, 2017 at 14:37
  • I am trying to access this link from VB.NET web_request which worked alright also I did tried using POSTMAN too Dec 18, 2017 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.