I currently have access to Ticketmaster's Discovery API. I want to take a link like this
https://www1.ticketmaster.com/zpl-jingle-jam-featuring-lizzo-why-dont-we/event/05005726960D2E82
and use the ID to get event data from Discovery API. When I tried in API explorer it said ID was wrong. I found out the ID is actually vv16AZAjJPOZACd2ad.
Is there any way to use ID from the URL to reference the given event? I see you can in partner API, but that's not easy to join from what I see.
If that's not at all possible, how are people able to create stock checkers in discord? For example: !stock 05005726960D2E82 would return stock remaining for the given event broken down by sections.
It's not possible with discovery API since that wasn't it's intended purpose.
Related
I need to automatically generate url to the existing advertisement in google adwords. I've got a link like this:
https://adwords.google.com/cm/CampaignMgmt?authuser=1&__u=%param_one%&__c=%param_two%#c.%param_three%.create&app=cm
I do not know what are those params one, two, and three. I do not know where can I get them and what is their role in an address. But I'd like to! In fact I just need to generate a URL to click on it and appear on an ad page. How can that be done? May be their lib provides a method to generate url like this?
Unfortunately that's not possible, at least not in a reliable way (see also this rather old post from the Adwords API forum).
The structure itself is not hard to parse:
Inside the query string, __u is your user account's ID while __c refers to the ID of the specific Adwords account. These don't appear to be in standard Adwords XXX-XXX-XXXX format, though, so you would have to either create a mapping of all your accounts or come up with the proper translation function.
The fragment refers to a specific Adwords entity, for instance; c.123 is the campaign with ID 123 while a.ABC_XYZ refers to the adgroup with ID ABC inside the campaign with ID XYZ.
But even if you manage to get the __u and __c parameters right, more often than not you will be redirected to your Adwords account's top level view.
Interestingly enough, Google Analytics introduced little buttons in the "Adwords" reporting tab a few months ago which are supposed to take you right to the correct campaign if you have access to the linked account, but even those only work half of the time, especially if your Adwords account is an MCC.
I'm trying to list most popular (or newest) videos of a channel by its name using YouTube 3.0 API.
I already implemented this, just not sure if it is correct way to do this, so need an advice.
First of I find channel ID by name (e.g. TEDxTalks in place of {channel_name}):
https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q={channel_name}&key={API_KEY}
Then I get videos of this channel ID, ordered by viewCount (or date), which perfectly lists videos:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channel_id}&order=viewCount&type=video&key={API_KEY}
How reliable is the first request? If name is the exact match of channel url slug or username (e.g. tedxtalks), will it always return corresponding channel? Or is there any more reliable way to get channel ID by its name?
Thank you.
Search API is not for exact match query. And it searching for all channel title(username found in URL if exist), channel name(xxx added 1 video) and even channel ID!
To answer your question, unfortunately it's not reliable and no other more reliable way.
A quick example, try to query username "abc".
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&q=abc&type=channel&key={YOUR_API_KEY}
The Search API response will return ABCNetwork, ABCNews, udruzenjeabc... and so on. No channelTitle(username) "abc" in the first 50 items.
Even though not all channels have username. If you got username of specific channel, then you should use Channel API for exact match query,
https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername=abc&maxResults=5&key={YOUR_API_KEY}
You might wonder why YouTube API doesn't provide exact search for "channel name"(xxx added 1 video)? It's because channel name is not unique, as a person name is not unique.
As indicated at https://developers.google.com/youtube/v3/guides/working_with_channel_ids:
If you are using v3 and want to retrieve the channel ID that
corresponds to the currently authorized user, you can call the
channels.list(part="id", mine=true) method. This is equivalent to
asking for the channel profile of the default user in v2.
If you ever do find yourself with an arbitrary legacy YouTube username
that you need to translate into a channel ID using v3 of the API, you
can make a channels.list(part="id", forUsername="username") call to
the API.
If you only know a display name and are looking to find the
corresponding channel, the search.list(part="snippet", type="channel",
q="display name") method will come in handy. You should be prepared to
deal with the possibility of the call returning more than one item in
the response, since display names are not unique.
Finally, i have no idea why YouTube didn't force to generate a unique readable username (like how Facebook add a random number at the end of duplicated username, e.g. zuck.5 and zuck.21 ) for all new user.
References:
https://developers.google.com/youtube/v3/docs/search/list
https://developers.google.com/youtube/v3/docs/channels/list#try-it
https://support.google.com/youtube/answer/2657968?hl=en
https://developers.google.com/youtube/v3/guides/working_with_channel_ids
I would like to know if is there any possible way to show the total number of users of a specific country in my webpage. As far as I found, you can not get it through API.
I'm guessing you really want the total number of users on facebook who have 'liked' or used facebooks oauth to connected with your site.
Do you use graph api in your site? I'm pretty sure you can query by country name--as long as the user's who have shared that info with you have provided it.
Check this out... http://developers.facebook.com/docs/reference/api/
And this: http://developers.facebook.com/docs/reference/api/insights/
From their site
Facebook Insights provides the ability to see geographic and
demographic data for people that have Liked a Page or installed an
app. Location data is based on the geographic location of each person
as determined by their browser IP address and is limited to the top 20
countries and cities. All other demographic information is aggregated
and non-personally identifiable.
Generic searches can be done like this:
https://graph.facebook.com/search?type=location&place=166793820034304
Where the place id is the id for whatever you want to search on.
https://graph.facebook.com/search?type=location&place=166793820034304
Disclamer: This method is not supported by Facebook. Use it at your own risk. I take no responsibility whatsoever.
Go to: https://www.facebook.com/ads/manage/adscreator/
Fill in the ad info with something random (eg. google.com as the url)
In the next part you'll notice a dynamic reach estimation that changes depending on the parameters you select, including country. Try changing the country and observe the network activity with for instance the developers tools of Google Chrome.
Call the ajax url that returns the json data with the proper parameters programatically, this should be easy to figure out in the previous step.
Collect and store the json data for your evil deeds.
???
PROFIT!
The actual ajax call and parameters change from time to time, which is why I didn't include them directly, but it should be easy enough to figure it all out. Also note that they are estimates, even if they come from Facebook, they don't count every single user every time an advertiser sets up an ad — it's the best estimate you can possibly get though.
This method as I mentioned is neither official nor supported by Facebook, but sites like socialbakers.com or checkfacebook.com have been using them for ages. (There, I revealed the secret)
What I am trying to do is a twitter bot for retweeting whatever I have in my DMbox.
So I need a few things.
I need to follow all the users who follow me. (I did that)
I need to read the DMs( I have to do)
Tweet the DM (I can do it i guess)
Delete the Read DMS(I dont think I wil be able to do it without help)
The problem with reading DMs are I am getting all the DMs at once. How can I tweet it one by one, I mean how I can take one DM from this Response I am getting for "$_GET['https://api.twitter.com/1/direct_messages.json']"
Now after retweeting all these DMs how can I delete all of them?
If you are using the GET direct_messages method provided by the REST API, you can use a combination of the since_id, max_id, and count to request one DM (count) older than (max_id) or more recent than (since_id) some known DM. https://dev.twitter.com/docs/api/1/get/direct_messages
Here is an example: https://api.twitter.com/1/direct_messages.json?count=1&since_id=1270520569
After you have grabbed the DM and thus, received it's id, you can grab your next DM using the above code and delete the current message using the POST direct_messages/destroy/:id method also available through the REST API. https://dev.twitter.com/docs/api/1/post/direct_messages/destroy/%3Aid
Here is an example of the delete method: https://api.twitter.com/1/direct_messages/destroy/1270520569.json
To get the first DM that you use to begin your process of retrieving messages, simply use the GET direct_messages with a count of 1 and move either backwards or forwards (max_id or since_id) depending on how Twitter orders the tweets. If they are not ordered by time, you'll simply have to explore in both directions.
I am just checking into the Adwords API. My target is to create and manage 750 - 800 text ads with some keyword corresponding to the product by fetching data from my database. I use PHP Client Library. I tried using the adGroupAdService mutate to create these ads with the data in array of textAdGroupAdOperation.
But i get
"EntityCountLimitExceeded.ADGROUP_TEXT_AD_LIMIT
# operations"
So i tried using the BulkMutateJob Service to accomplish this task by modifying the 'PerformBulkMutateJob' example provided in the library. on running the script, i get the message like
"Bulk mutate request with job id
"6700245679675929654" and part number
"0" was added. Unmarshalling Error:
cvc-type.2: The type definition cannot
be abstract for element
ns1:operations."
I don't know whether i'm in the correct direction. Please help me in fixing this issue and guide me in creating these Ads.
Thanks.
The EntityCountLimitExceeded.ADGROUP_TEXT_AD_LIMIT error means that you're adding too many ads into an ad group. You need to spread the ads out across multiple groups.