API Create Customer works great, cannot update ContactAddress

67 views
Skip to first unread message

David Rancour

unread,
Nov 6, 2017, 10:39:57 AM11/6/17
to Lightspeed Retail API Developers

Hello -

I am working on a Customer integration using the Lightspeed API and XML end points.

I can create a new customer fine - my code captures the results of the POST and deserializes the XML into my native C# objects.


I then proceed to update the Contact address information, serialize back to XML, and attempt a PUT request to the new customer ID XML end point.

No matter what I send, the full Customer including the ContactAddress node or just the ContactAddress node, I get BAD REQUEST back.

I am capturing all the XML and URI's being used during the process and everything looks correct. Below is the full Customer XML being sent to the new customer ID XML  end point.

Is it possible to update the Customer Contact Address information using the API?

thanks for any assistance!


<?xml version="1.0" encoding="utf-16"?>
<Customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <firstName />
  <lastName>Company Name Here</lastName>
  <title />
  <company>Company Name Here</company>
  <companyRegistrationNumber />
  <vatNumber />
  <creditAccountID>0</creditAccountID>
  <customerTypeID>2</customerTypeID>
  <discountID>0</discountID>
  <taxCategoryID>0</taxCategoryID>
  <customerID>11</customerID>
  <createTime>2017-11-04T17:08:19+00:00</createTime>
  <timeStamp>2017-11-04T17:08:19+00:00</timeStamp>
  <archived>false</archived>
  <Contact>
    <custom />
    <noEmail>false</noEmail>
    <noPhone>false</noPhone>
    <noMail>false</noMail>
    <Addresses>
      <ContactAddress>
        <address1>123 That Street</address1>
        <address2 />
        <city>Some City</city>
        <state>CA</state>
        <zip>90250</zip>
        <country>USA</country>
      </ContactAddress>
    </Addresses>
    <Phones />
    <Emails />
    <Websites />
    <timeStamp>2017-11-04T17:08:19+00:00</timeStamp>
  </Contact>
</Customer>

David Rancour

unread,
Nov 6, 2017, 12:02:25 PM11/6/17
to Lightspeed Retail API Developers
James @ LS helped me out on their site, turns on UTF-16 is not valid, must use UTF-8. After modifying my code the contact information updates as expected. Thanks James!
Reply all
Reply to author
Forward
0 new messages