API endpoints

You can find the API key for your store from ACF's dashboard under "Settings"

API functions are currently rate limited to 1 call every 2 seconds. If you exceed this, the function will return HTTP 429 (Too Many Requests)

Upload media to ACF media storage

To upload one or more media file(s) for a custom field to ACF media storage:

POST https://app.accentuate.io/api/{api_key}/media 
{
   "media": {
     "scope": "product|variant|custom_collection|smart_collection|page|blog|article|order|customer|shop",
     "scope_id": 1234567890,
     "metafield": "accentuate.main_image",
     "src": [
        "http://example.com/some_image.jpg",
        "http://example.com/some_other_image.jpg"
     ]
   }
}

The list of  src urls needs to be full HTTP/HTTPS urls and publicly available.

scope_id is the object id related to the provided scope, e.g. a product id, a collection id etc. For the  shop scope, you don't need to provide a scope_id

HTTP 200 is returned with this payload for a valid request:

{
   "media": {
     "src": [
          { "url": "http://example.com/some_image.jpg", "status": "uploaded" },
          { "url": "http://example.com/some_other_image.jpg", "status": "uploaded" }
     ],
     "url": [
        "https://cdn.accentuate.io/12345678/12345678/some_image-v12345678.jpg",
        "https://cdn.accentuate.io/12345678/12345678/some_other_image-v12345678.jpg"
     ]
   }
}

The response contains an array of  src elements with a status for each source url. The status is either "uploaded" or "failed". If an upload fails, the corresponding url element will be an empty string.

Following a successful request where all  src urls have status = "uploaded", all previous media files in ACF media storage for that custom field are deleted and you need to update the value of the custom field with the returned url value to keep your media references valid.

If one or more of the  src urls for the request fails to upload, any previous media files in ACF media storage are left untouched. It is up to you to either skip updating your custom field entirely or selectively use the new url for the src urls that succeeded

Delete media from ACF media storage

To delete all media(s) for a given metafield, use the POST method with an empty  src array:

POST https://app.accentuate.io/api/{api_key}/media 
{
   "media": {
     "scope": "product|variant|custom_collection|smart_collection|page|blog|article|order|customer|shop",
     "scope_id": 1234567890,
     "metafield": "accentuate.main_image",
     "src": []
   }
}

HTTP 200 is returned with this payload for a valid request:

{
   "media": {
     "src": [],
     "url": []
   }
}

Clear ACF cache

ACF internally works with a server-side cache to speed up operations when reading both metafields and various Shopify objects. 

This means that when you update your metafields via Shopify's API, ACF won't see it right away and you risk overwriting your newly changed metafields' content if someone is working in the ACF editor with a stale cache.

To fix that, you need to tell ACF to refresh its internal cache following any updates you have performed:

DELETE https://app.accentuate.io/api/{api_key}/cache

HTTP 200 is returned for a valid request, otherwise a 4xx or 5xx error is returned

Please note, that clearing the server-side cache via the API won't clear any client-side caches that ACF works with inside your Shopify admin. If you are missing some newly added or updated objects when working in the ACF editor, use the refresh button in the Quick Navigation box

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us