AppStoreConnect API - Error 404 when fetching build icon

Hi folks!

After fetching all icons for all builds (v1/builds/{id}/icons) which returns an array of BuildIcon, I can't fetch any icon that comes inside the response.

I'm using the attributes->iconAsset->templateURL as URL of the icon I want to retrieve, but I'm getting 404 for all of them.

Every URL has the following prefix: https://is4-ssl.mzstatic.com/image

What am I doing wrong here?

Any help will be much appreciated. Thanks!

Replies

Adding an example of a response that comes from this endpoint:

▿ BuildIcon

  • type : AppStoreConnect_Swift_SDK.BuildIcon.Type.buildIcons
  • id : "OWE5Y2Y3NWItMTYwNS00ZTljLTkxYzItOTNhYzRkYTg3MjU5IEFQUF9TVE9"

▿ attributes : Optional<Attributes> ▿ some : Attributes - name : nil ▿ iconAsset : Optional<ImageAsset> ▿ some : ImageAsset ▿ templateURL : Optional<String> - some : "https://is4-ssl.mzstatic.com/image/thumb/Purple126/v4/96/d8/9e/96d89ef8-13cb-8b09-8647-301d410b1807/AppIcon-0-1x_U007emarketing-0-5-0-85-220.png/%7Bw%7Dx%7Bh%7Dbb.%7Bf}" ▿ width : Optional<Int> - some : 1024 ▿ height : Optional<Int> - some : 1024 ▿ iconType : Optional<IconAssetType> - some : AppStoreConnect_Swift_SDK.IconAssetType.appStore ▿ links : ResourceLinks - this : "https://api.appstoreconnect.apple.com/v1/buildIcons/OWE5Y2Y3NWItMTYwNS00ZTljLTkxYzItOTNhYzRkYTg3MjU5IEFQUF9TVE9"

I managed to find the answer to my own question after some trial and error, and I'm posting here the information in case someone else bumps into the same problem.

This is the build icon URL that comes inside the response of v1/builds/{id}/icons request to AppStoreConnect API:

https:&#x2F;&#x2F;is4-ssl.mzstatic.com&#x2F;image&#x2F;thumb&#x2F;Purple126&#x2F;v4&#x2F;96&#x2F;d8&#x2F;9e&#x2F;96d89ef8-13cb-8b09-8647-301d410b1807&#x2F;AppIcon-0-1x_U007emarketing-0-5-0-85-220.png&#x2F;{w}x{h}.{f}

Don't make a GET request to this URL as-is because it won't work. You will get a 404 not found HTTP error.

Make theses changes to the URL:

  • replace {w} with the value (INT) that comes in attributes->width
  • replace {h} with the value (INT) that comes in attributes->height
  • replace {f} with ".png" as most (if not all) icons are PNG files

Applying this 3 changes to the above URL, we get:

https:&#x2F;&#x2F;is4-ssl.mzstatic.com&#x2F;image&#x2F;thumb&#x2F;Purple126&#x2F;v4&#x2F;96&#x2F;d8&#x2F;9e&#x2F;96d89ef8-13cb-8b09-8647-301d410b1807&#x2F;AppIcon-0-1x_U007emarketing-0-5-0-85-220.png&#x2F;1024x1024bb.png

Copy and paste this URL to your browser and voilà! You've got the build icon ;-)

The need for this replacements is not documented on AppStoreConnect API online documentation.