26

Could an iOS app get the iTunes link of itself? Before publishing the app, the appstore id is unknown. Is there an API for this?

est
  • 11,429
  • 14
  • 70
  • 118

3 Answers3

75

Here is the answer.

  1. The app requests http://itunes.apple.com/lookup?bundleId=com.clickgamer.AngryBirds
  2. Find the "version": "2.1.0" and "trackId": 343200656 in the JSON response.

Warning: This API is undocumented, Apple could change it without notice.

References:

[1] https://github.com/nicklockwood/iVersion/blob/master/iVersion/iVersion.m#L705
[2] https://stackoverflow.com/a/8841636/41948
[3] http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsLookup?id=343200656&mt=8
[4] http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/wsSearch?term=+Angry+Birds&country=US&media=software&entity=softwareDeveloper&limit=6&genreId=&version=2&output=json&callback=jsonp1343116626493

Community
  • 1
  • 1
est
  • 11,429
  • 14
  • 70
  • 118
  • 1
    This API is (no longer) undocumented. – https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html#lookup – Koraktor Dec 23 '14 at 13:40
  • 3
    @Koraktor Yes, lookup by `id` is documented, however, lookup by `bundleId` is not. – est Dec 24 '14 at 13:12
  • 1
    Old and closed question but I wanted to contribute a way to get the ID from iOS itself. From either the homescreen or the app store, you can ‘share’ apps which will present the share sheet which has an option to copy the url. – canibeanartist Sep 11 '19 at 08:11
15

You way use iTunes Search API to look up your and other apps on the App Store.

Docs: http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

Example: http://itunes.apple.com/search?media=software&country=us&term=raining%20weather

iTunes may return more then one result, but you can filter results by bundleId. trackViewUrl will contain iTunes URL to your app. trackId will contain app's ID.

Aleksejs Mjaliks
  • 8,647
  • 6
  • 38
  • 44
-4

Until your app is approved and published for the first time you cannot get the app store link. I would recommend using bit.ly shorturl with a random link in your app. Once the app is approved you can change the bit.ly destination to the app store link.

imthi
  • 4,798
  • 1
  • 22
  • 24
  • 5
    Not completely true. Once you have an appId (i.e., after your app has been created in iTC) you can create one of the long, unreadable URLs. The shorter, human readable itunes.com ones probably won't work until the app is on the App Store. – Stephen Darlington Mar 15 '12 at 11:31