Is there any way I can use google-image serach API? - c#

I want to retrive search results from google images from my .net application. Is there any way out there?

Yes, there is.
The Google Image Search API offers access through a RESTful interface, as described here, on the API reference page.
You can use e.g. the WebRequest class to make the API calls, and use one of the JSON libraries as listed on this page, such as Json.NET or JSONSharp to parse the returned JSON data.

Related

How to develop a Query Refinement tool using C# / Asp.Net

Want to develop a query refinement tool just like Google Suggest so that i will get recommended options when i enter keywords in the search textbox i.e( if i type "car"
i will get the recommended options as rental cars,used cars,cars for sale etc) want to develop the tool in c#/ASP.Net dont know where to start.please give some suggestions.
This can be achieved by using javascript and let's say some web service / page method. You send the values that user gave you to a web service. The web service translates the text, make some database (or other storage) request and return the results to the page as json (or some other format that suits you).
Look at this article if you need some example code:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=515
By the way, if you need more articles, just put "asp.net autocomplete" into Google. That should give you plenty of resources.

how to download a partial web page using .net

We are downloading a full web page using System.Net.WebClient class. But we only want less than half of the page. So is there a way to download a portion of the page, say 1/3rd, half etc of a page using .net library so that We can save the network bandwidth and the space? If so, please throw your ideas, thanks.
You need to provide an "Accept-Ranges header" to your GET or POST request. That can be done by using the AddRange method of your HttpWebRequest:
HttpWebRequest myHttpWebRequest =
(HttpWebRequest)WebRequest.Create("http://www.foo.com");
myHttpWebRequest.AddRange(0,100);
That would yield the first 100 bytes. The server, however, needs to support this.
The sort answer is not unless the web app supports some way to tailor it's response to what you want it to return.
This could take the form of a
query string parameter
header field value
The simplest way to add this would be a query string parameter and when detected write out the necessary HTML to the response object. If you are unable to make changes to the web app then you won't be able to control how much of a page is returned to you.
You might want to read up on how HTTP works since the question and it's answer relies upon this. Specifically the Header Definition should be helpful.

How do I integrate google search into my C# program?

I'm working on a program in Visual C#.NET and I need some help.
I need it to be able to take in some text through a text box, then somehow send that text to google, and bring back the resulting URLs (not the full results, just the URLs) and then display those in my program. How would I do that?
Use the WebClient class to send the query to Google and read the response.
Alternatively, use a .NET library that interacts with the Google search API, like this one (this was just the first Google result).
There are also REST libraries for .NET, if you go with the newer custom search.
Unfortunately the Google Web Search API is deprecated and no longer available. However the next best thing IMO is Google Custom Search Engine.

Facebook Credits/Payment API in C# or VB .net?

I can't seem to find any code examples anywhere online that even hint at any way to use the Facebook API or Facebook SDK with C#.net (or even VB.net) to use the Facebook Credits features.
Does anyone know of any .Net examples that could help show how to use the Facebook Credits features?
Most of the calls required to use the credits API are actually just graph calls which will work fine with the C# SDK. The other stuff like the the callbacks you are going to have to do own your own.
Well i think the Documentation by Facebook is Sufficient enough.
I have not used Facebook C# SDK but For use in .Net you can simply use HttpRequest/HttpResponse classes to do Send/Recive data.
For parsing JSON you can use JSON.Net or use JavaScriptSerializer Class.
Here is an Example with JavaScriptSerializer. Its for Facebook Feeds but you can use somthing similar for Credits too.
I see this is an old one, i'd like to contribute, having just fought this fight, and resorted to using network monitor to capture the raw tcp traffic to figure out what was going on.
Facebook is NOT sending a content-type of json, its
"ContentType: application/x-www-form-urlencoded"
They aren't sending JSON!! they are sending a form post
This caused no end of grief for me. I'm including an actual network snag of their data. I have no idea what they are doing , and its directly against their documentation. https://developers.facebook.com/docs/credits/callback/
"signed_request=[The signed request]&buyer=[my id]&receiver=[my id]&order_id=247146405372045&order_info=%22100credits%22&test_mode=1&method=payments_get_items"
TO tie it more directly to the question, if you're using asp.net, you can just accept a form post. If you using WCF, its a hassle
Accept Stream as the input to your WCF method
parse it out,
//Get the Stream
var postStream = new StreamReader(input).ReadToEnd();
//parse the string
var vals = HttpUtility.ParseQueryString(postStream);

How to add "Attachment" in Google Apps Calendar using Google API version 2?

I am using Google API Version 2 fo .NET to create Google Calendar Entries.
How can i add "Attachment" to Google Calendar?
Thanx
I was trying to find the answer to this question myself, and after looking through the XML results for various queries using the Calendar API feeds, I'm pretty sure there isn't currently a way to retrieve or update file attachments. Since calendar event file attachments is a lab feature from Google, it's not entirely surprising that they aren't yet available through the public API.
Depending on what you are trying to do, you could use extended properties to store additional information about attachments in an event, but these values won't be read by the calendar web client, so you would only be able to use them for your own application.
A couple other things (admittedly hacks) you could try:
The ICAL feed provided by Google
Calendar provides an ATTACH:
property. You could have your app use
the import url to import an ics file
containing your attachment.
You could
simulate the web client, which posts
a gdoc-attachment parameter to update
an events with an attachment.
You also might try posting to the calendar help forums. The only related post I could find was here.
Good luck!
For all the future generations reading this, the attachments are now supported, here is the guide on how to do it: https://developers.google.com/google-apps/calendar/create-events#attachments

Categories