BinarySamurai
BinarySamurai

Reputation: 1

Inuit TimeActivity Create: The request sent by the client was syntactically incorrect

I am trying to test my ability to import TimeActivity records and even when using the sample Create Request XML for TimeActivity I get an error:

Apache Tomcat/7.0.23 - Error report

HTTP Status 400 -

type Status report

message

description The request sent by the client was syntactically incorrect ().

Apache Tomcat/7.0.23

below is my sample xml create request (pulled from https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/timeactivity)

<?xml version="1.0" encoding="utf-8"?>
<TimeActivity xmlns:ns2="http://www.intuit.com/sb/cdm/qbo"     xmlns="http://www.intuit.com/sb/cdm/v2">
<TxnDate>2011-08-03-07:00</TxnDate>
<NameOf>Vendor</NameOf>
<Vendor>
<VendorIdidDomain="QBO">3793</VendorId>
</Vendor>
<CustomerId>3794</CustomerId>
<ItemId>3</ItemId>  
<ClassId>1</ClassId>  
<StartTime>2011-08-30T11:45:00-07:00</StartTime>
<EndTime>2011-08-30T13:15:00-07:00</EndTime>  
<Taxable>true</Taxable>
<HourlyRate>10.5</HourlyRate>
<BillableStatus>Billable</BillableStatus>
<Hours>10</Hours>
<Minutes>5</Minutes>
<Description>This is a Description</Description>
</TimeActivity>

What am I doing wrong here?

Upvotes: 0

Views: 214

Answers (3)

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

I tried the same XML in Api Explorer. It worked fine for me. PFB snapshot. Please check if you are facing any encoding issue.

Please let me know if it works for you.

enter image description here

Upvotes: 1

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

There should be couple of small changes in the sample request ( We will update the doc )

<?xml version="1.0" encoding="utf-8"?>
<TimeActivity xmlns:ns2="http://www.intuit.com/sb/cdm/qbo"     xmlns="http://www.intuit.com/sb/cdm/v2">
<NameOf>Vendor</NameOf>
<Vendor>
<VendorId idDomain="QBO">5</VendorId>
</Vendor>
<CustomerId>2</CustomerId>
<ItemId>3</ItemId>  
<Taxable>true</Taxable>
<HourlyRate>10.5</HourlyRate>
<BillableStatus>Billable</BillableStatus>
<Hours>10</Hours>
<Minutes>5</Minutes>
<Description>This is a Description</Description>
</TimeActivity>

First replace all the reference values with the same of your test data. For ex - VendorId, Class, Item and Customer

There are two bugs in the sample request.

 1. There should be a space between 'VendorId' and 'idDomain' ( Ref -5th line of the req )
 2. According to the doc,  " Either method of indicating duration can be entered, but not both. Hours/Minutes OR StartTime/EndTime is required."
    So plz remove any one of these. ( I've removed StartTime/EndTime )
    Otherwise you'll get the error which you have mentioned above.
    That is - Response code 400, Error msg - TIME_ACTIVITY_MULTIPLE_DURATION_TYPES_PRESENT

Please let us know if the above changes work for you.

Upvotes: 2

Manas Mukherjee
Manas Mukherjee

Reputation: 5340

Sharing a sample TimeActivity create request. Please check other reference attributes like Vendor, Class etc. It should work.

<?xml version="1.0" encoding="utf-8"?>
<TimeActivity xmlns='http://www.intuit.com/sb/cdm/v2'>
<TxnDate>2012-08-30-07:00</TxnDate>
<NameOf>Employee</NameOf>
<Employee>
    <EmployeeId>11</EmployeeId>
</Employee>
<CustomerId>2</CustomerId>
<JobId>4</JobId>
<BillableStatus>Billable</BillableStatus>
<HourlyRate>50.0</HourlyRate>
<StartTime>2012-08-30T11:45:00-07:00</StartTime>
  <EndTime>2012-08-30T13:15:00-07:00</EndTime>
<Description/>
</TimeActivity>

Upvotes: 2

Related Questions