mindbody

mindbody api post CustomClientFields


Im using the API class from Mindbody GetClientServices to access the MindBody Api. Works great.

Now i need to add custom values to the client defined in the Mindbody CMS (ie exmployer)

So this is the array i am using:

array('UpdateAction'=>'Update',
 'Clients'=>array( 
  'Client'=>array(
   'ID'=>'100015637',
   'FirstName'=>'dummy'.$i,
   'LastName'=>'Galaxy'.$i,
   'BirthDate'=>'2010-05-24T18:13:00', //https://stackoverflow.com/questions/2899332/not-a-valid-allxsd-value
   'Username'=> 'helloDummy1'.$i,
   'Password'=> 'amin1216$1'.$i,
   'Email'=>'dummy'.$i.'@noblestreet.eu',
   'EmailOptIn'=> new SoapVar('true', XSD_STRING, 'xsd:boolean'),
   'SendEmail'=> new SoapVar('true', XSD_STRING, 'xsd:boolean'),
   'MobilePhone'=>'9770534045',
   'HomePhone'=>'9770534045',
   'WorkPhone'=>'9770534045',
   'Address'=>'dummy'.$i,
   'Address2'=>'dummy'.$i,
   'City'=>'dummy'.$i,
   'State'=>'ZH',
   'Country'=>'NL',
   'PostalCode'=>'2511HA',
   'ForeignZip'=>'2511HA',
   'Bio'=>'dummy'.$i,
   'Status'=>'active',
   'CustomClientFields' => array(
    'CustomClientField'=> array(
      0 => array(
        'ID' => '1',
        'value'=>'test'
      )
    )
   )
  )
 )
);

On posting this to the API the customfield doesnt get added and i cant see it in the MB cms.

Any help on this one?

btw inserting/updating other values works


Solution

  • The comment made by Yuga was the correct answer:

    1) Post resulting XML request you're sending to Mindbody API.

    2) Try comparing your XML to the example XML updating custom fields shown on https://developers.mindbodyonline.com/Develop/ClientService.

    3) Which XML response do you get? You may get an error, I suppose.

    4) Most probably you need to send 'Value' not 'value'.

    5) Make sure you send <Fields><string>Clients.CustomClientFields</string></Fields> in your XML request

    Point 4 (correcting the typo value to Value) solved my problem.