How to update custom field values for Customer

I'm writing a sync between Lightspeed and another system. I want to store my external customerId in Lightspeed, using a custom field.

So, i've created a custom field for that, but unfortunately i cannot update custom fields using the API.

How can I accomplish this?


Thanks,

Arjan

2 comments

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 299 moderator

    Hi @arjanduijzer,

    Thank you for contacting us.

    You can do this by using the following payload in the customer endpoint.

    PUT /Customer/{customer_id}.json
    

    Payload:

    {
    	"CustomFieldValues": {
                "CustomFieldValue": {
                    "customFieldID": "2",
                    "type": "string",
                    "value": "123456789"
                }
            }
    }
    

    I hope this helps.

  • arjanduijzerarjanduijzer Member Posts: 2

    Thanks for your answer. I've tested this from my code, but unfortunately it seems not working. The field value is not updated (not in result and not in Lightspeed)


    This is my request, specially the field "WWMRelationId"



    PUT https://api.lightspeedapp.com/API/Account/164996/Customer/1 HTTP/1.1

    Accept: application/json

    Authorization: Bearer *************

    Cookie: __cfduid=************

    Content-Type: application/json; charset=utf-8

    Content-Length: 926

    Host: api.lightspeedapp.com


    {"customFieldValue":[{"customFieldValueID":294,"customFieldID":2,"name":"Nieuwsbrief","type":"boolean","value":"true"},{"customFieldValueID":1089,"customFieldID":7,"name":"Erkenningnummer","type":"string","value":"12345"},{"customFieldValueID":1090,"customFieldID":4,"name":"Jachtaktenummer","type":"integer","value":"1"},{"customFieldValueID":1091,"customFieldID":5,"name":"Verlofnummer","type":"integer","value":"2"},{"customFieldValueID":1092,"customFieldID":6,"name":"Verona Clientnummer","type":"integer","value":"3"},{"customFieldValueID":1093,"customFieldID":3,"name":"Erkenninghouder","type":"boolean","value":"true"},{"customFieldValueID":1124,"customFieldID":1,"name":"Membership","type":"single_choice","value":{"customFieldChoiceID":"1","name":"Standaard","value":"","canBeDeleted":"false","customFieldID":"1"}},{"customFieldValueID":1133,"customFieldID":8,"name":"WWMRelationId","type":"integer","value":"3964"}]}

Sign In or Register to comment.