Is there any way to use the Facebook API (or other method) to get the image URL for my ad images? I have a list of image hashes, but how can I get their URLs?
Alternatively, is there another way to get the URL of my ad images without relying on the hash? I am trying to download them all systematically.
Yes! Get the permalink_url of an image using the /adimages edge off the adaccount node. You can also return the hash value and filter the query by a list of specific hashes:
https://graph.facebook.com/v13/act_<AD_ACCOUNT_ID>/adimages?
fields=id,permalink_url,
hash&hashes=["<IMAGE_HASH_1>","<IMAGE_HASH_2>"]
This returns:
{
"data": [
{
"id": "<AD_IMAGE_ID>",
"permalink_url": "https://www.facebook.com/ads/image/?d=<UNIQUE_NUMBER>",
"hash": "<IMAGE_HASH_1>"
},
{
"id": "<AD_IMAGE_ID>",
"permalink_url": "https://www.facebook.com/ads/image/?d=<UNIQUE_NUMBER>",
"hash": "<IMAGE_HASH_2>"
},
],
"paging": {
"cursors": {
"before": "<VALUE>",
"after": "<VALUE>"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With