Customer metadata sub-resources

See Customer Metadata.

GET https://yoursite.com/v1/store/api/customer/metadata/
POST https://yoursite.com/v1/store/api/customer/metadata/
DELETE https://yoursite.com/v1/store/api/customer/metadata/

Get the customer's metadata

GET https://yoursite.com/v1/store/api/customer/metadata/
$.get('/v1/store/api/customer/metadata/');

🚧

GET requests to the /customer/metadata/ endpoint return 404 when the customer does not already have a metadata record. POSTing data to the same route will create one.

{
  created_at: '2015-08-15T17:06:18Z',
  updated_at: '2015-08-15T17:06:18Z',
  customer_id: 359835,
  store_id: 46981,
  data: {
    "eye color": "green",
    "height": "6ft",
    "shirt size": "Large"
  }
}

Create or set the customer's metadata

POST https://yoursite.com/v1/store/api/customer/metadata/
$.ajax({
    url: '/v1/store/api/customer/metadata/',
    contentType: 'application/json',
    type: 'POST',
    data: JSON.stringify({'eye color': 'green'}),
    success: function(data) {
        console.log(data);
    }
});

🚧

POST requests to the metadata endpoints will overwrite any existing records.

{
  created_at: '2015-08-15T17:06:18Z',
  updated_at: '2015-08-15T17:06:18Z',
  customer_id: 359835,
  store_id: 46981,
  data: {
    "eye color": "green",
    "height": "6ft",
    "shirt size": "Large"
  }
}

Delete customer metadata

Delete https://yoursite.com/v1/store/api/customer/metadata/
$.ajax({
    url: '/v1/store/api/customer/metadata/',
    contentType: 'application/json',
    type: 'DELETE',
    success: function(data) {
        console.log(data);
    }
});

Response

204 No Content