How to get the iOS app Apple ID from a Bundle ID? - ios

If I have the Bundle ID of an app, is it possible to programmatically get the Apple ID? eg. the xxx part in this url: http://itunes.apple.com/lookup?id=xxx
Using the lookup url above, it is possible to do the reverse: get the bundle id given an app's apple id.
I'm ultimately looking to programmatically get the icon of an app, but I only know the Bundle ID of the apps. any help is appreciated.

This is actually remarkably easy and can be done programatically by simply changing the parameter of my original query from 'id' to 'bundleID'
eg. http://itunes.apple.com/lookup?bundleId=xxx
The response will be a JSON object with the results that will include the thumbnail url among other things. eg.
{
"resultCount":1,
"results": [
{
"screenshotUrls":[...],
"ipadScreenshotUrls":[...],
"artworkUrl512":"...",
"artistViewUrl":"...",
"artworkUrl60":"...",
"artworkUrl100":"...",
...
}
]
}

Related

Getting CloudKit CKAsset URL?

I'd like to share a CloudKit asset in the public database with people who aren't using my app. From the CKAsset class, there's only a fileURL property, which points to a local file, so no URL given.
On the documentation for CloudKit Web Services, however, there is a "referencing existing assets" request, which in its' response gives a downloadURL to the asset file.
Calling this from my app gives me a 421 status code, which is described in documentation as "AUTHENTICATION_REQUIRED", as it requires a ckSession parameter to be given, which is a "session identifier of an authenticated user". It also passes a redirectURL, where a user can type in their iCloud login, and then be re-directed back to the web application, now with a session identifier.
Opening this URL inside the app didn't immediately return the session identifier, but instead expected the user to go through the login process in a browser, before receiving their session ID.
This seems totally off-track, and the wrong thing to be doing. I'm certainly not going to make my users log in to iCloud through a web interface. The only thing missing for that CloudKit Web Services url is the session ID. Is there a way for me to get that using the CloudKit framework? Or is there another way for me to find out this file's URL?
If you are using Apple's official CloudKit.js, here is the code to configure your CloudKit access:
window.addEventListener('cloudkitloaded', function() {
console.log('Cloudkit loaded');
CloudKit.configure({
locale: 'en-us',
containers: [{
containerIdentifier: 'iCloud.com.getYoursInXcode',
apiTokenAuth: {
apiToken: 'getThisInCloudkitDashboardApiAccess',
persist: true //Set cookie
},
environment: 'production'
}]
});
// Do your thing here
})
If you are fetching records in your backend, it is still better to get your API token instead of using the Server-To-Server process.
For example, query records in GO, to fetch a record, compose your request body like this
sampleRequest = []byte('{
"resultsLimit":"4",
"desiredKeys": ["recordTitle","recordDescription"],
"query": {
"recordType": "myRecord",
"sortBy": {
"fieldName": "rank",
"ascending": true
}
}
}')
And send it to the following Url
http.NewRequest("POST", ""https://api.apple-cloudkit.com/database/1/iCloud.com.yourIdentifier/production/public/records/query?ckAPIToken=YOURTOKEN", bytes.NewBuffer(RequestBody))

Can't get views by insightTrafficSourceType — YouTube Analytics API

So I'm using the 'google-api-client' gem with Rails, and I'm attempting to call the URL below in order to get video views by day and insightTrafficSourceType. This is a call that appears to be allowable from the Available Reports documentation page.
Additionally, I found that I was able to make this call by using the API Explorer tool provided by Google.
URL:
https://www.googleapis.com/youtube/analytics/v1beta1/reports?metrics=views&ids=channel==CHANNEL_ID&dimensions=day,insightTrafficSourceType&filter=video==VIDEO_ID&start-date=2013-01-15&end-date=2013-01-16&start-time=1970-01-01
Result:
{
:error=>
{
"errors"=>[
{
"domain"=>"global",
"reason"=>"invalid",
"message"=>"Unknown identifier (insightTrafficSourceType) given in field parameters.dimensions."
}
],
"code"=>400,
"message"=>"Unknown identifier (insightTrafficSourceType) given in field parameters.dimensions."
}
}
I'm not sure what extra data I can provide in the initial description of this bug, but as stated before I am making the call to the API with the Google::APIClient Ruby library. The actual code itself looks like this:
client.execute(
:api_method => api.reports.query,
:parameters => options
)
You are still referencing the old beta API, i.e., in your URL, you have 'v1beta' and you should have 'v1' there. Try replacing that and running it again. Also, you can look at the api explorer to see the exact URL that should be generated in live examples with your acct (once you enable OAuth) here:
https://developers.google.com/youtube/analytics/v1/
(Look at the bottom of the page.)
Finally, start-time isn't a parameter listed on the production version of the API, so you will want to remove that as well.

Can't get views by insightPlaybackLocationType — YouTube Analytics API

So I'm using the 'google-api-client' gem with Rails, and I'm attempting to call the URL below in order to get video views by insightPlaybackLocationType. This is a call that appears to be allowable from the Available Reports documentation page.
Unfortunately, I found that I was not able to make this call by using the API Explorer tool provided by Google.
URL:
https://www.googleapis.com/youtube/analytics/v1beta1/reports?metrics=views&ids=channel==CHANNEL_ID&dimensions=day,insightPlaybackLocationType&filter=video==VIDEO_ID&start-date=2013-01-15&end-date=2013-01-16&start-time=1970-01-01
Result:
{
:error=>
{
"errors"=>[
{
"domain"=>"global",
"reason"=>"invalid",
"message"=>"Unknown identifier (insightPlaybackLocationType) given in field parameters.dimensions."
}
],
"code"=>400,
"message"=>"Unknown identifier (averageViewDuration) given in field parameters.dimensions."
}
}
I'm not sure what extra data I can provide in the initial description of this bug, but as stated before I am making the call to the API with the Google::APIClient Ruby library. The actual code itself looks like this:
client.execute(
:api_method => api.reports.query,
:parameters => options
)
You'll need to set the version to v1 not v1beta1.
The start-time parameter seems wrong to me. You already specified start-date
Check the API explorer:
http://developers.google.com/apis-explorer/#p/youtubeAnalytics/v1/youtubeAnalytics.reports.query?ids=channel%253D%253DCHANNEL_ID&start-date=2012-12-15&end-date=2013-01-16&metrics=views&dimensions=day%252CinsightPlaybackLocationType&filters=video%253D%253DVIDEO_ID&_h=4&

Can't get views by averageViewDuration — YouTube Analytics API

So I'm using the 'google-api-client' gem with Rails, and I'm attempting to call the URL below in order to get video views by averageViewDuration. This is a call that appears to be allowable from the Available Reports documentation page.
Additionally, I found that I was able to make this call by using the API Explorer tool provided by Google.
URL:
https://www.googleapis.com/youtube/analytics/v1beta1/reports?metrics=averageViewDuration&ids=channel==CHANNEL_ID&dimensions=day&filter=video==VIDEO_ID&start-date=2013-01-15&end-date=2013-01-16&start-time=1970-01-01
Result:
{
:error=>
{
"errors"=>[
{
"domain"=>"global",
"reason"=>"invalid",
"message"=>"Unknown identifier (averageViewDuration) given in field parameters.metrics."
}
],
"code"=>400,
"message"=>"Unknown identifier (averageViewDuration) given in field parameters.metrics."
}
}
I'm not sure what extra data I can provide in the initial description of this bug, but as stated before I am making the call to the API with the Google::APIClient Ruby library. The actual code itself looks like this:
client.execute(
:api_method => api.reports.query,
:parameters => options
)
Could you try that again with v1 as the version instead of v1beta1?
Also, you have a start-time parameter at the end of your request URL, and that's not a valid parameter.
I just gave a similar query with those changes a try and it works.

Finding Facebook ID from URL

In Facebook's documentation it says you can find the ID from a URL, and that used to be the case. It doesn't appear to be true anymore.
This example is straight from Facebook's API Documentation:
--------------FACEBOOK DOCS---------------------
The "ids" query parameter also accepts URLs. This is useful for finding IDs of URLs in the Open Graph. For example: https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
But when you click on that link it gives you:
{
"http://www.imdb.com/title/tt0117500/": {
"id": "http://www.imdb.com/title/tt0117500/",
"shares": 18226,
"comments": 7
}
}
Which does NOT include the real Facebook ID for this example URL. If I go to the debugger and enter this URL I can find the ID, which is: 380728101301
So how can I find the ID without using the Open Graph Debugger? I need to be able to get IDs through the code on my site, and can't manually visit the debugger every time.. anyone know how to do this now?
Thanks very much!
There is one possibility with FQL:
SELECT url,site,id FROM object_url WHERE url = 'http://www.imdb.com/title/tt0117500';
https://developers.facebook.com/docs/reference/fql/

Resources