[#57] create booking

Migrated from Redmine #57 | Author: umair meon
Status: Rejected | Priority: High, I’m very impatient | Created: 2017-10-19


i was try this code for create booking but show error “Selected date start is not available”
Here is my code
$eventId=1;
$unitId=1;
$clientData=array(‘name’=>‘umair’,‘email’=>‘test@gmail.com’,‘phone’=>‘+38099999999’);
$data=“2017-10-20”;
$time=“10:00:00”;
$book = $client->book ($eventId, $unitId, $date, $time, $clientData);

Dmytro Bondarev wrote:

You can get this error because selected date/time not available to book.
To check this we need more information.

Please provide company login.

umair meon wrote:

ok now i have got this error
“Client with given id not found”

Dmytro Bondarev wrote:

Ok, probably client with this id does not exists.

umair meon wrote:

so tell me how can i solve this ?

Redmine Admin wrote:

you need to use existing id of existing client or add client first and then use his id

umair meon wrote:

please check my code and than tell me which part i was changed?

umair meon wrote:

i already use real email in clientdata

Dmytro Bondarev wrote:

We are not able to help you without full information.

umair meon wrote:

i am use this function
book ($eventId, $unitId, $date, $time, $clientData, , $count, $batchId, $recurringData)
in this function there is no any client id needed so why i got this error

"An uncaught Exception was encountered

Type: Exception

Message: Request error: Client with given id not found"

Dmytro Bondarev wrote:

As i said it is impossible to help you without information.
Please provide full request to API.

umair meon wrote:

which type of information you need?

Dmytro Bondarev wrote:

Please provide full request to API.

umair meon wrote:

$this->load->library(“JsonRpcClient”);
$loginClient = new JsonRpcClient(‘http://user-api.simplybook.me’ . ‘/login/’);
$token = $loginClient->getUserToken(‘fashion’, ‘admin’, ‘xxxxx’);
if($token!=“”){
$client = new JsonRpcClient(‘http://user-api.simplybook.me’ . ‘/admin/’, array(
‘headers’ => array(
'X-Company-Login: ’ .‘fashion’,
'X-User-Token: ’ . $token
)
));
i used this request

Dmytro Bondarev wrote:

It is code to get token.
We need full HTTP request to API to book with all data.

umair meon wrote:

$this->load->library(“JsonRpcClient”);
$loginClient = new JsonRpcClient(‘http://user-api.simplybook.me’ . ‘/login/’);
$token = $loginClient->getUserToken(‘fashion’, ‘admin’, ‘xxxx’);
$client = new JsonRpcClient(‘http://user-api.simplybook.me’ . ‘/admin/’, array(
‘headers’ => array(
'X-Company-Login: ’ .‘fashion’,
'X-User-Token: ’ . $token
)
));
$clientData = array(
‘name’ => ‘Abdul Qadir’,
‘email’ => 'un489@hotmail.com ',
‘phone’ => ‘+92 3313542329’
);
$eventId=1;
$unitId=1;
$date=“2017-10-21”;
$time=“10:00:00”;
$book = $client->book($eventId, $unitId, $date, $time, $clientData);

Redmine Admin wrote:

please check

(Short original content)

Dmytro Bondarev wrote:

Please check the reference API documentation | SimplyBook.me Online Scheduling
You are using wrong parameters for this method.

Dmytro Bondarev wrote: