API lookup does not find thing - am I using the correct URLs? - flattr

I am currently working on a Flattr plugin for a popular open-source RSS reader (tiny tiny RSS).
I am using the lookup API for the first time and am unsure why I am getting mixed results.
So I'm unsure if I use the API correctly and want to confirm with you experts if I got something basic wrong.
First, let's see if I can come up with an API call that looks up a thing successfully. I look at the Flattr page of thing 1066706 (I can't post the whole URL here as SO only allows me two URLs for this whole post). On that page, I find the official URL which Flattr stores for that thing and look that up with the API:see here
This returns {"type":"thing","resource":"https:\/\/api.flattr.com\/rest\/v2\/things\/1066706", ... so that's good.
But it seems this method is not a sure way to test if things exist. Here is an example that doesn't work: I open the Flattr page of thing e7579b349cb7b319b28d883cd4064e1e.
That URL I find on that page is indeed the URL of that article and I don't see any other URL it might have. I look that up in the same way as above:check this
Alas, I get {"message":"not_found","description":"No thing was found"}
(I also tried both of these with encoded URLs, but got the same result. I figured this is easier to read for you.)
So, why would that second thing not be found? Thanks for any enlightenment.

The id "e7579b349cb7b319b28d883cd4064e1e" is not a real thing id but a hash that identifies a temporary thing for a not yet submitted thing - it's part of Flattr's autosubmit functionality: http://developers.flattr.net/auto-submit/
So the system is very correct in telling you that a thing for that URL doesn't exist - someone would need to flattr that thing for it to become submitted for real and created in the system with a real id to it.
(Just for reference - for some URL:s, like Twitter URL:s, Flattr can actually answer that the URL is flattrable even though it can't find it in the system: {"message": "flattrable", "description": "Thing is flattrable "} That way you can now that it is possible to flattr that thing without you having to use any kind of flattr-button/url supplied by the author to be able to flattr the URL)
Also - if you don't know it yet then for a RSS reader you should primarily be looking for rel-payment links to find out whether an entry is flattrable or not, see http://developers.flattr.net/feed/ and http://relpayment.com/

Related

Is it possible to use the Canonical Landscape API to get script output?

The documentation I can find for the Canonical Landscape API lets you do lots of things with scripts, but I can't find anything suggesting that you can get output. However, if you use the Canonical web interface, script output is available, so it's presumably exposed somehow...?
I just had this issue as well and since you're the first hit right now on google, I wanted to share the answer for everyone - if you run ExecuteScript on a landscape client and get back an ID of 123, and let's assume the job finished already - you want to then use that ID to ask the GetActivities API, with an input argument of "query" with value "parent-id:123". If there is a result there, you will find the script output you are looking for under the result_text field of the response. Good luck!!! It worked over here very well.

Google I'm Feeling Lucky URL

So, I've spent about 2 hours trying to get the I'm Feeling Lucky URL to work. It seems the URL doesn't like the periods in the search parameter, so does anyone have any potential tricks?
Search Value= 40.840.1/8Z
The first result in a regular Google search is the correct page.
Here's what I've tried:
http://www.google.com/search?btnI=I&q=40.840.1/8Z
http://www.google.com/search?btnI=I&q=40.840.1%2F8Z
http://www.google.com/search?btnI=I&q=40%2E840%2E1/8Z
http://www.google.com/search?btnI=I&q=40%2E840%2E1%2F8Z
http://www.google.com/search?btnI=I&q=40%2F840%2F1%2F8Z
(That one was actually pretty close)
http://www.google.com/search?btnI=I&q=40%20840%201%208Z
And all of the above surrounded in quotes (%22)
The problem is that the I'm Feeling Lucky aspect doesn't work. It finds the correct results, it just doesn't navigate to the first result. I'm open to alternatives besides the I'm Feeling Lucky URL parameters as well.
I'm trying to implement this into a .NET application that provides employees with resource information, which is best received from the manufacturer's website(s). The trick is that the resources are from many different suppliers and the links need to be somewhat automatic. Basically I don't whomever manages the software to update these links. To navigate, I'm simply using the Process.Start("http://www.example.com/") command which uses the default browser to navigate to the address.
This post helped a lot by the way.
I wasn't able to get any closer than your closest one.
But if it helps, here's an alternative way of writing the "I'm feeling lucky" URL.
http://google.com/search?q=haimer+usa+40%2F840%2F1%2F8Z&btnI
What I did to find the right url is to navigate to google.com. After this I turned my internet connection off. I entered the search details and pressed submit. You can now see the url in the address bar, but it doesn't redirect you to the first result. You can now copy the url and see how google treats your dots and other weird characters.
So to recap:
Go to google.com
Turn your internet connection off
Enter search term
Press 'I'm feeling lucky'
Copy the url from the address bar
You can create a google custom search engine of your own, and either exclude certain sites or include specific sites only, use http://cse.google.com to do this.
There is a SO tag for google custom search

What should be located at the homepage of a REST API?

I'm currently in the process of writing a REST API and this question always seems to popup.
I've always just added a description, quick links to docs, server time etc, but see now (after looking around a bit) that a simple redirect to the API docs would be even better.
My question is what would be the accepted norm to have as the root - '/' - "homepage" of your API?
I've been looking at a few implementations:
Facebook: Just gives a error of "Unsupported get request.";
Twitter: Shows an actual 404 page;
StackOverflow: Redirect to quick "usage" page.
After looking at those it's clear everyone is doing it differently.
In the bigger picture this is of little significance but would be interesting to see what the "RESTfull" way of doing it (if there is one) might be.
Others have had the same question and as you discovered yourself everyone is doing it their own way. There is a move in this direction to somehow standardize it, so see if you find this draft useful:
Home Documents for HTTP APIs aka JSON Home.
I've give this much thought and right now I either return a 404 page, a health status page, a dummy page or redirect to another page, mostly likely on within the organization.
An API homepage isn't something everyone should be looking at and believe me, it can be found. There are more people like me that love to inspect the browser and see how a website is performing.

How to access Google Search "I'm Feeling Lucky" functionality using API?

I'm creating a sample app that will take a query from user and will return the URL result returned from Google's "I'm Feeling Lucky" search. Does Google expose this functionality through their API? How to access this?
It seems that Google change their I'm feeling lucky url.
A workaround is to use https://duckduckgo.com/?q=!ducky+github+foo+bar+foobar
https://duckduckgo.com/?q=!ducky+YOUR_URL_ENCODED_QUERY
There is nothing magic about Google's "I'm Feeling Lucky" functionality. It simply picks the first result of the search. So, however you're using the api, you can just select the first result as well.
Furthermore, you can use this format for a URL in order to hit the "I'm Feeling Lucky" result of Google:
http://www.google.com/search?q=my+keywords+for+search&btnI
Deprecated You could use the Google API which is probably the best way to do it but will require more work
api docs here https://developers.google.com/web-search/docs/
No longer working or you can go to this url with your seach query:
http://www.google.com/webhp#q=your+search+query+here&btnI
be sure you add &btnI to the end otherwise it wont redirect
Update 2014
The above URL stopped working and yes the search API is depreciated, however there are always workaround. If you really have to you can still use a simple get request on the following URL:
https://www.google.com/search?q=your+search+query+here&btnI=
with of course your+search+query+here replaced with a URL encoded string.

Flickr API - Photos Search, excluding tags: Am I doing this wrong?

So, I'm trying to pull all photos of a specific user's account via the flickr.photos.search method, but I want to exclude photos with a particular tag. The related documentation page states that "You can exclude results that match a term by prepending it with a - character." ... Well, I tried implementing that option but what get in return is only one photo (even though there are several photos with the tag in question) and that result remains the same whether that specific photo has the tag in question or not AND whether or not I use the "-" option to exclude that tag rather than include it. I also tried the text method with the same exact result. Here's my REST call:
http://api.flickr.com/services/rest/?&method=flickr.photos.search&api_key='.$api_key.'&user_id='.$user_id.'&tag_mode=any&tags=-blog&extras=url_o,url_t&format=json
And here is the page where I'm trying to get this all working:
http://corazonbrew.com/temp/
Anyone know what is going on here?
It seems the answer in the Flickr discussion board I linked to earlier is proving true. In order to use the exclusion option, there has to also be at least one other, non-excluded tag. Well, that is just not good enough for me.
A couple of friends tell me this is a longstanding bug that will not be fixed anytime soon, if ever. But those friends also kindly reminded me of my n00bishness- this whole time I thought I needed to affect the feed to get the desired output. I totally was not realizing I could just use some good ol' PHP if statements to weed out what I don't want.