Update customer's notes


I am trying to update customer's notes field and getting a 400 response code about some invalid CustomFieldValue

I am sending only 
{
    "Note": {
       "note": "Some text here"
    }
}

Here is the response

PUT https://api.merchantos.com/API/Account/{AID}/Customer/{CID}.json
resulted in a `400 Bad Request` response:
{
    "httpCode":"400",
    "httpMessage":"Bad Request",
    "message":"Invalid CustomFieldValue date="2017-09-21T03:00:00-0400",
}

Why is this happening and how to fix it?
Tags:

4 comments

  • gregaricangregarican Member Posts: 714 
    Are you setting the HTTP request type as PUT? If you are accidentally setting the request type as POST (like when creating a new customer) then there might be unexpected results. 

    Just tested this out and it worked fine for me :smile:

    Content-Type: text/plain
    cache-control: no-cache
    Postman-Token: 3d2934c4-54b4-4d49-8a13-e51f7dbfd4b4
    Authorization: Bearer {AccessToken}
    User-Agent: PostmanRuntime/7.1.1
    Accept: */*
    Host: api.merchantos.com
    cookie: __cfduid=db226f08af7bd70432115fe0872508a6f1518446657
    accept-encoding: gzip, deflate
    content-length: 50
    Connection: close

    { "Note": { "note": "This is an updated note." } }

    HTTP/1.1 200 OK
    Date: Mon, 24 Sep 2018 19:38:46 GMT
    Content-Type: application/json
    Content-Length: 1058
    Connection: close
    x-frame-options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    X-LS-Acct-Id: 164019
    X-LS-OAuth-Client-Id: 64577
    X-LS-API-Bucket-Level: 10/100
    X-LS-Shard-Id: 18
    X-LS-API-Drip-Rate: 5
    X-LS-Master-System: true
    X-LS-Master-Account: true
    X-LS-Master-Catalog: false
    Vary: Accept-Encoding
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    CF-RAY: 45f7b699090410ed-ORD

    @{"@attributes":{"count":"1"},"Customer":{"firstName":"Joe","lastName":"Schmoe","title":"","company":"","companyRegistrationNumber":"","vatNumber":"","creditAccountID":"0","customerTypeID":"0","discountID":"0","taxCategoryID":"0","Contact":{"custom":"","noEmail":"false","noPhone":"false","noMail":"false","Addresses":{"ContactAddress":{"address1":"7980 Maxtown Rd.","address2":"","city":"Westerville","state":"OH","zip":"","country":"","countryCode":"","stateCode":""}},"Phones":{"ContactPhone":{"number":"6142185170","useType":"Home"}},"Emails":"","Websites":"","timeStamp":"2018-09-05T13:36:49+00:00"},"Note":{"note":"This is an updated note.","isPublic":"false","timeStamp":"2018-09-05T13:45:34+00:00"},"CustomFieldValues":{"CustomFieldValue":[{"customFieldValueID":"2493","customFieldID":"1","name":"Legacy ID","type":"string","value":"700000"},{"customFieldValueID":"4041","customFieldID":"2","name":"Anniversary ","type":"date"}]},"customerID":"2504","createTime":"2018-06-03T06:29:15+00:00","timeStamp":"2018-09-05T13:45:34+00:00","archived":"false"}}
  • valentinvalentin Member Posts: 6
    The request is PUT.

    It works fine for some customers, but not for all.

    The easiest fix is to have the customer go to the custom field setting and check "Include Time"
  • rsirotarsirota Member Posts: 94

    I am having a similar time. Testing in Postman I am trying to add a Note to the customers notes and am getting the following error:

    {

    "httpCode": "400",

    "httpMessage": "Bad Request",

    "message": "JSON Input was invalid. Error Message: Syntax error",

    "errorClass": "InvalidArgumentException"

    }

    My PUT statement is:

    https://api.lightspeedapp.com/API/Account/{{accountID}}/Customer/8694.json

    and the body is:

    {

    "Note": {"note" : "This is a test note"}

    }

    I am going to try just doing it in php

  • rsirotarsirota Member Posts: 94

    It was a problem with Postman, the actual code worked!

Sign In or Register to comment.