How can I update a custom field on a customer record using the API?

tdelletttdellett Member Posts: 3
The title pretty much says it all. I have a custom text field on customer records that I would like to update using the API via PHP.


Best Answers

  • tdelletttdellett Member Posts: 3
    Accepted Answer
    Thank you, that's perfect. I was pretty sure that's the way it was supposed to be but I don't like to assume.


  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator
    You're welcome!
    James Ratcliffe
    Lightspeed HQ
  • agrohsagrohs Member Posts: 6
    Get that this is how to populate on create/update for a customer, but wondering how I get these to come back when looking up a customer record? Right now even when I look up a customer using 'load_relations=all', it still does not include the CustomFieldValues. How do I get those back for a given Customer?
  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    @agrohs, you can make a request and load the specific relation like this:{{accountID}}/Customer.json?load_relations=["CustomFieldValues"]

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator

    @agrohs Custom Fields aren't loaded by load_relations=all because loading them is very, very resource intensive.

    In general, we recommend always loading the specific relations you need instead of using load_relations=all. This helps minimize the response time.

    James Ratcliffe
    Lightspeed HQ
  • ChrochrodileChrochrodile Member Posts: 2
    Hello, I would like to know how we can update a custom choice field with the API. What the difference from a custom text field update. 
Sign In or Register to comment.