UpdateCurrentUserProfileAttribute

SmithCart > Integration > REST Endpoints
Usage
Updates a profile attribute for a user
Basic URI
/users/me/profile/{attribname}.json
Parameters
string attribename     The profile's attribute name
HTTP Example
https://domain.com/DesktopModules/Smith.BuyNow/Services/v1/Checkout.svc/users/me/profile/{attribname}.json
AUTH
Bearer JWT
 
C# Code
 
JavaScript Code
<script>
   (function ($) {
       var CLIENT_ID = "4SnPA6lqpY76ODEr",
           SERVICE_URI = "https://domain.com/DesktopModules/Smith.BuyNow/Services/v1/",
           ATTRIB_NAME = "FirstName",
           ATTRIB_VALUE = "Test";

       function updateUserProfileAttribute (endPoint, clientID, attribName, attribValue) {
           var jwt = sessionStorage.getItem("jwt");

           $.ajax({
               type: "PUT",
               url: endPoint + "/Checkout.svc/users/me/profile/" + attribName + ".json",
               headers: { "Authorization": "Bearer " + jwt },
               data: JSON.stringify ({
                     "property_name": attribName, "property_value": attribValue
               }),
               contentType: "application/json; charset=utf-8",
               dataType: "json"
           }).fail(function (jqXHR, textStatus) {
               console.log("SmithCart API: " + textStatus);
           });
       }

       $(function () {
           updateUserProfileAttribute(SERVICE_URI, CLIENT_ID, ATTRIB_NAME, ATTRIB_VALUE);
       });
   })(jQuery);
</script>
 
 
 
Response
SET "FirstName" = "Test"