Jump to content

Problem with API add clients custom fields


lobuljen

Recommended Posts

I have problem with adding clients with internal script via api. I have two custom fields witch are required and when I try to add client there error emerges telling me that one custom fields isn't fulfilled.

I checked id (numbers) of custom fields and tried every way what come on my mind.

$command = "addclient";
$adminuser = "lobuljen";
$values["firstname"] = "Test";
$values["lastname"] = "User";
$values["companyname"] = "WHMCS";
$values["email"] = "user@domain.com";
$values["address1"] = "123 Demo Street";
$values["city"] = "Demo";
$values["state"] = "Florida";
$values["postcode"] = "AB123";
$values["country"] = "US";
$values["phonenumber"] = "123456789";
$values["password2"] = "demo";
$customfields = array(
     '1' => "67565453546",
     '2' => "Pravna osoba"
);
$values["customfields"] = base64_encode(serialize($customfields))
$values["1"] = "67565453546";
$values["currency"] = "1";

$results = localAPI($command,$values,$adminuser);

 

Where is problem?

Link to comment
Share on other sites

  • 3 weeks later...

This is working solution give by support

 

$customfields = array(

'1' => "xxx",

'2' => "xxx"

);

$values["customfields"] = $customfields;

$values["customfield"] = $customfields;

 

It works well with internal api but for external api I found out myself that only this works as should

 

$postfields["customfield[1]"] = "xxx";

$postfields["customfield[2]"] = "xxx";

 

Hope this will help to someone.

Link to comment
Share on other sites

as :

 

 

$postfields["customfield[1]"] = "xxx"; Admin API ?

$postfields["customfield[2]"] = "xxx"; password API ?

 

thanks

 

- - - Updated - - -

 

Can you please give me the full integration if you don't mind because I dont know which string I shouls substitute ?

 

thanks so much

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated