Is it possible to update tags on a customer with the api

raresrares Posts: 4Member
My client would like to be able to programmatically update the tags on a customer when updating. I have not seen that this is possible with the api and was wondering if anyone is aware if this is possible. 

Thanks 

1 comment

  • gregaricangregarican Posts: 192Member 
    I had a similar requirement and was able to implement it just fine via the API. Here below is a sanitized example of a Fiddler trace, where I queried a specific customer record, including the Note relation. Then I issued a PUT statement to update the customer's note. The API response displays the updated note value.

    All based off what's listed in the API docs --> https://developers.lightspeedhq.com/retail/endpoints/Customer/

    Hope this helps!


    GET https://api.merchantos.com/API/Account/{AccountId}/Customer/2504.json?load_relations=[%22Note%22]

    HTTP/1.1
    cache-control: no-cache
    Postman-Token: 9365fd67-67e3-4dc5-b7ac-ea4a43eabfcc
    Authorization: Bearer {AccessToken}
    User-Agent: PostmanRuntime/7.1.1
    Accept: */*
    Host: api.merchantos.com
    cookie: __cfduid=db226f08af7bd70432115fe0872508a6f1518446657
    accept-encoding: gzip, deflate
    Connection: close


    HTTP/1.1 200 OK
    Date: Wed, 05 Sep 2018 13:43:31 GMT
    Content-Type: application/json
    Content-Length: 449
    Connection: close
    x-frame-options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    X-LS-Acct-Id: {AccountId}
    X-LS-OAuth-Client-Id: 64577
    X-LS-API-Bucket-Level: 1/100
    X-LS-Shard-Id: 18
    X-LS-API-Drip-Rate: 5
    X-LS-Master-System: true
    X-LS-Master-Account: false
    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: 4559201448995564-ORD

    {"@attributes":{"count":"1"},"Customer":{"firstName":"Joe","lastName":"Schmoe","title":"","company":"","companyRegistrationNumber":"","vatNumber":"","creditAccountID":"0","customerTypeID":"0","discountID":"0","taxCategoryID":"0","Note":{"note":" This is a test note.","isPublic":"false","timeStamp":"2018-09-05T13:36:49+00:00"},"customerID":"2504","createTime":"2018-06-03T06:29:15+00:00","timeStamp":"2018-09-05T13:36:49+00:00","archived":"false"}}

    ------------------------------------------------------------------

    PUT https://api.merchantos.com/API/Account/{AccountId}/Customer/2504.json

    HTTP/1.1
    Content-Type: text/plain
    cache-control: no-cache
    Postman-Token: 8d4b5bc9-3d15-4688-b03e-d4f26b319e70
    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: Wed, 05 Sep 2018 13:45:34 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: {AccountId}
    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: 455923144a0325bb-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"}}

    ------------------------------------------------------------------

Sign In or Register to comment.