[#135] problem to creat

Migrated from Redmine #135 | Author: umair meon
Status: Closed | Priority: High, I’m very impatient | Created: 2018-03-29


i have problem to create booking with api here is my code

$eventId=1;
$unitId=1; 
$clientData = array(
'name' => 'Umair',
	'email' => 'memumair939@gmail.com', 
	'phone' => '+92 3313542329'
);
$startDate="2018-04-1";
$endDate="2018-04-2";
$startTime="09:00:00"; 
$endTime="05:00:00";
$booknew = $client->book($eventId, $unitId, $addClient, $startDate, $startTime, $endDate, $endTime,"UTC -5:00 / -4:00");

and show this error
Selected time start is not available
i which step iam wrong please help me

Dmytro Bondarev wrote:

  1. “UTC -5:00 / -4:00” - is wrong parameter you should pass offset between company timezone and client timezone in seconds.
  2. $clientData - wrong parameter you should pass client id.
  3. “2018-04-1” - wrong date format.

please fix this issues and if it does not solve problem, please provide us full http request.

umair meon wrote:

I am follow this date format

  • $startDate a date string in format ‘Y-m-d’*

Dmytro Bondarev wrote:

d - is day with lead 0

umair meon wrote:

face same issue with changing this
$startDate=“2018-04-01”;
$endDate=“2018-04-02”;
$startTime=“9:00:00”;
$endTime=“10:00:00”;
Message: Request error: Selected time start is not available

Dmytro Bondarev wrote:

please provide us full http request.

umair meon wrote:

$startDate=“2018-04-01”;
$endDate=“2018-04-02”;
$startTime=“9:00:00”;
$endTime=“10:00:00”;
$addClient=$client->addClient($clientData);
$booknew = $client->book($eventId, $unitId, $addClient, $startDate, $startTime, $endDate, $endTime,“60”);

Redmine Admin wrote:

it is not http request

Dmytro Bondarev wrote:

it is not http request. it is your code and we do not know how it works inside.
that is why we need request, that you send to our server. it should like:

@POST /login HTTP/1.1
Host: user-api.simplybook.me
Content-Type: application/json

{“jsonrpc”:“2.0”,“method”:“getUserToken”,“params”:[“…”,“…”,“…”],“id”:1}@

umair meon wrote:

$this->load->library(“JsonRpcClient”);
$loginClient = new JsonRpcClient(‘http://user-api.simplybook.me’ . ‘/login/’);

    $token = $loginClient->getUserToken('hyderswf', 'admin', 'xxxxxx');
	echo  $token;
if($token!=""){
	$client = new JsonRpcClient('http://user-api.simplybook.me' . '/admin/', array(

‘headers’ => array(
'X-Company-Login: ’ .‘hyderswf’,
'X-User-Token: ’ . $token
)
));

Dmytro Bondarev wrote:

Please look at example. It is your code. We do not know how it works inside.

umair meon wrote:

I am follow this docs link

Dmytro Bondarev wrote:

If you did everything right, but still get this error, check that this time available to book.

umair meon wrote:

In my time setting sat 9 to 6 i have written in start time 9 but show not available
like that
$startDate=“2018-04-02”;
$endDate=“2018-04-03”;
$startTime=“09:00:00”;
$endTime=“10:00:00”;

Dmytro Bondarev wrote:

Please check if this time available to book.

umair meon wrote:

Yes available from 9 am to 6 pm

Dmytro Bondarev wrote:

Are you able to book this time from admin side?
I see that the start date and end date is different. Why?

umair meon wrote:

i am already use this code few month age run perfectly but he should give me error

umair meon wrote:

$startDate=“2018-04-02”;
$endDate=“2018-04-02”;
$startTime=“12:00:00”;
$endTime=“06:00:00”;

same date but issue is still

Dmytro Bondarev wrote:

Why did you set 06:00:00?
Is it possible that end date less than start date?