Update customer's notes

valentinvalentin Posts: 2Member

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:

2 comments

  • gregaricangregarican Posts: 137Member ✭
    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:

    PUT https://api.merchantos.com/API/Account/{AccountId}/Customer/{CustomerId}.json HTTP/1.1
    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 Posts: 2Member
    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"
Sign In or Register to comment.