How to correctly write a PUT request in shopify using jquery ajax?

Topic summary

A developer is attempting to update a Shopify customer’s metafield using a jQuery AJAX PUT request but encountering issues. While the same request works successfully in Postman, the web-based implementation returns a success response without actually updating the data.

Current Implementation:

  • Using jQuery’s $.ajax() method with type ‘PUT’
  • Targeting Shopify’s Admin API metafields endpoint
  • Setting content-type as ‘application/json; charset=utf-8’
  • Passing metafield data as JSON stringified object

The Problem:
Despite receiving success callbacks, the metafield changes are not persisting in Shopify. The discrepancy between Postman (working) and browser-based requests (not working) suggests potential issues with authentication headers, CORS policies, or request formatting specific to browser environments.

The discussion remains open with no resolution provided yet.

Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

How to correctly write a PUT request to shopify using jquery ajax?

I need to make changes in the client’s additional field by means of a PUT request in jquery

Using Postman - everything works, but through the webfront I get success, but there are no changes, why is that?

My code:

$.ajax({
    type : 'PUT',
    url : 'https://xxx:xxx_xxx@mydomain.myshopify.com/admin/api/2023-01/customers/5976393646168/metafields/21215617450072.json',
    contentType: "application/json; charset=utf-8",
    data : JSON.stringify({"metafield":{"value":"qweqweqwe"}}),    
    success: function() {
        alert('success');
    },
    error: function() {
        alert('error');
    }
})