-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Wondering if you have thoughts on this.
If a client is already booked at some time, and you attempt to create another appointment with them at the time in which they are already booked, the request fails but there is no message in the response:
[181] pry(main)> response.message
=> nil
However there is an error in the response body:
[182] pry(main)> response.body[:add_or_update_appointments_response][:add_or_update_appointments_result][:appointments][:messages]
=> "100015707 Already booked - Client is already booked at this time"
Here's the full response:
[178] pry(main)> response
=> #<MindBody::Services::Response:0x007f808e7639d0
@api_status=#<MindBody::APIStatus::Success:0x007f80970f1120 @message=nil>,
@current_page_index="0",
@error_code="201",
@response=
#<Savon::Response:0x007f808e763ef8
@globals=
#<Savon::GlobalOptions:0x007f8090810f70
@option_type=:global,
@options=
{:encoding=>"UTF-8",
:soap_version=>1,
:namespaces=>{},
:logger=>
#<Logger:0x007f8090810de0
@default_formatter=#<Logger::Formatter:0x007f8090810db8 @datetime_format=nil>,
@formatter=nil,
@level=0,
@logdev=#<Logger::LogDevice:0x007f8090810d68 @dev=#<IO:<STDOUT>>, @filename=nil, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f8090810d40 @mon_count=0, @mon_mutex=#<Mutex:0x007f8090810cf0>, @mon_owner=nil>, @shift_age=nil, @shift_size=nil>,
@progname=nil>,
:log=>false,
:filters=>[],
:pretty_print_xml=>false,
:raise_errors=>true,
:strip_namespaces=>true,
:convert_response_tags_to=>#<Proc:0x007f8090810c28@/Users/jharbert/.rvm/gems/ruby-2.2.1/gems/savon-2.11.0/lib/savon/options.rb:85 (lambda)>,
:convert_attributes_to=>#<Proc:0x007f8090810c00@/Users/jharbert/.rvm/gems/ruby-2.2.1/gems/savon-2.11.0/lib/savon/options.rb:86 (lambda)>,
:multipart=>false,
:adapter=>nil,
:use_wsa_headers=>false,
:no_message_tag=>false,
:follow_redirects=>false,
:unwrap=>false,
:wsdl=>"/Users/jharbert/.rvm/gems/ruby-2.2.1/bundler/gems/mindbody-api-203fd1bfda78/wsdl/AppointmentService.wsdl",
:open_timeout=>60,
:read_timeout=>60,
:endpoint=>#<URI::HTTPS https://api.mindbodyonline.com/0_5/AppointmentService.asmx>}>,
@hash=
{:envelope=>
{:body=>
{:add_or_update_appointments_response=>
{:add_or_update_appointments_result=>
{:status=>"Success",
:error_code=>"201",
:xml_detail=>"Full",
:result_count=>"0",
:current_page_index=>"0",
:total_page_count=>"0",
:appointments=>{:messages=>"100015707 Already booked - Client is already booked at this time", :error_code=>"504", :duration=>nil, :action=>"Failed"}},
:@xmlns=>"http://clients.mindbodyonline.com/api/0_5"}},
:"@xmlns:soap"=>"http://schemas.xmlsoap.org/soap/envelope/",
:"@xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
:"@xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema"}},
@http=
#<HTTPI::Response:0x007f80961405f0
@body=
"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><AddOrUpdateAppointmentsResponse xmlns=\"http://clients.mindbodyonline.com/api/0_5\"><AddOrUpdateAppointmentsResult><Status>Success</Status><ErrorCode>201</ErrorCode><XMLDetail>Full</XMLDetail><ResultCount>0</ResultCount><CurrentPageIndex>0</CurrentPageIndex><TotalPageCount>0</TotalPageCount><Appointments><Appointment><Messages><string>100015707 Already booked - Client is already booked at this time</string></Messages><ErrorCode>504</ErrorCode><Duration xsi:nil=\"true\" /><Action>Failed</Action></Appointment></Appointments></AddOrUpdateAppointmentsResult></AddOrUpdateAppointmentsResponse></soap:Body></soap:Envelope>",
@code=200,
@headers=
{"cache-control"=>"private, max-age=0",
"content-type"=>"text/xml; charset=utf-8",
"x-aspnet-version"=>"4.0.30319",
"x-powered-by"=>"ASP.NET",
"p3p"=>"CAO DSP COR CUR TAIa OUR NOR UNI STA",
"content-length"=>"837",
"date"=>"Fri, 12 Jun 2015 20:23:56 GMT",
"connection"=>"keep-alive",
"access-control-max-age"=>"86400",
"access-control-allow-headers"=>"Accept, SiteId, Authorization, Content-Type, Origin",
"access-control-allow-methods"=>"GET, POST, PUT, DELETE, OPTIONS",
"access-control-allow-credentials"=>"true",
"access-control-allow-origin"=>""},
@raw_body=
"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><AddOrUpdateAppointmentsResponse xmlns=\"http://clients.mindbodyonline.com/api/0_5\"><AddOrUpdateAppointmentsResult><Status>Success</Status><ErrorCode>201</ErrorCode><XMLDetail>Full</XMLDetail><ResultCount>0</ResultCount><CurrentPageIndex>0</CurrentPageIndex><TotalPageCount>0</TotalPageCount><Appointments><Appointment><Messages><string>100015707 Already booked - Client is already booked at this time</string></Messages><ErrorCode>504</ErrorCode><Duration xsi:nil=\"true\" /><Action>Failed</Action></Appointment></Appointments></AddOrUpdateAppointmentsResult></AddOrUpdateAppointmentsResponse></soap:Body></soap:Envelope>">,
@locals=
#<Savon::LocalOptions:0x007f80981c6978
@option_type=:local,
@options=
{:advanced_typecasting=>true,
:response_parser=>:nokogiri,
:multipart=>false,
:message=>
{"Request"=>
{"SourceCredentials"=>{"SourceName"=>"xxx", "Password"=>"xxx", "SiteIDs"=>{"int"=>["-99"]}},
"Appointments"=>{"Appointment"=>{"StartDateTime"=>"2015-06-15T12:00:00-04:00", "Location"=>{"ID"=>1}, "Staff"=>{"ID"=>"100000237"}, "Client"=>{"ID"=>100015707}, "SessionType"=>{"ID"=>23}, "Notes"=>"abc"}}}},
:soap_action=>"http://clients.mindbodyonline.com/api/0_5/AddOrUpdateAppointments"}>,
@nori=
#<Nori:0x007f808e7637c8
@options=
{:strip_namespaces=>true,
:delete_namespace_attributes=>false,
:convert_tags_to=>#<Proc:0x007f8090810c28@/Users/jharbert/.rvm/gems/ruby-2.2.1/gems/savon-2.11.0/lib/savon/options.rb:85 (lambda)>,
:convert_attributes_to=>#<Proc:0x007f8090810c00@/Users/jharbert/.rvm/gems/ruby-2.2.1/gems/savon-2.11.0/lib/savon/options.rb:86 (lambda)>,
:empty_tag_value=>nil,
:advanced_typecasting=>true,
:convert_dashes_to_underscores=>true,
:parser=>:nokogiri}>>,
@result=
{:appointments=>
#<MindBody::Models::Appointment:0x007f808e672530
@client=nil,
@client_service=nil,
@duration=nil,
@end_date_time=nil,
@first_appointment=nil,
@gender_preference=nil,
@id=nil,
@location=nil,
@notes=nil,
@program=nil,
@resources=[],
@session_type=nil,
@staff=nil,
@staff_requested=nil,
@start_date_time=nil,
@status=nil>},
@result_count="0",
@status="Success",
@total_page_count="0",
@xml_detail="Full">
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels