Use Mailjet.com's API from within Java web application - java

I want to make use of the Mailjet's API to get and post some information to Mailjet.
This is done via HTTP GET and POST request.
And example to get some information for a specific emailaddress is here:
https://eu.mailjet.com/docs/api/contact/infos
How can I invoke that from within a Java web app and get the array of information in Java?

I found the solution.
I used the Apache HttpComponents library.

In case this comes up in similar searches, we have a Java wrapper to help here:
https://github.com/mailjet/mailjet-apiv3-java
All the best.
Toby.

Related

How to use java-google-translate-text-to-speech api?

I read one answer here (How to use Google Translate API in my Java application?) and started to use java-google-translate-text-to-speech api as it is free.
But when I use this api in a standalone java file, I am facing an issue : "Your client does not have permission to get URL /translate_a/t from this server. That’s all we know." HTTP Reponse Code 403-Forbidden error.
Do I need to use API key to use this api ?
Is there any sample code which uses API key ?
I am posting a question for the first time so apologies if the formatting is incorrect.
Thanks in advance !!
The official API is 20$ for 1 million characters (proportionally), so you could still consider using it as it's quite cheap.
The project you're referring to hasn't been updated in a long time, so it could just be broken due to changes by Google....
In the comments they also referenced this project, you could try using this, but I would still recommend the official API's.

sample use cases for org.scribe.OAuthRequest.OAuthRequest(Verb verb, String url)

I am working on XeroAPI as a task given to me in my internship. i am not familiar with OAuth and i'm pretty much a newbie when it comes to programming. right now i managed to do a simple OAuth using Ashley Schroder's tutorial on Accessing Xero API for public applications using java his code is working fine and i managed to understand how it works(a little but enough to understand how to use it)
Here comes my problem, it happens that i need to use other http requests like PUT and POST. i researched for days before coming here but to no avail. i would like to know if there's someone here who can show me a thing or two on other use cases for Verb.PUT and Verb.POST
Ashley Schroder's Page for scribe oauth implentation for Xero API public application: Click Here
I would like to ask another question but i'll post it some other time.
Cheers,
You might consider using a client library that already has support for PUT requests, etc. E.g. here are two popular ones:
https://github.com/connectifier/xero-java-client
https://github.com/rossjourdain/XeroAPI-PrivateApplication-Java

How to search in google by using java code?

How to search in google by using java code?
I would have told you to use one of their API. Unfortunatly, there does not seems to exist one for search. As a consequence, you'll have to use HtmlUnit to emulate a browser and go see their results (obviously, you can go the harder way and do some HTTP queries by yourself. But who would do that ?).
Unfortunately the SOAP API has been deprecated. But you can use the AJAX API for non-JavaScript purposes as well, see for example:
http://www.ajaxlines.com/ajax/stuff/article/using_google_is_ajax_search_api_with_java.php
Update Jul 3 2018: This link is now broken; some code from there can be found here: https://stackoverflow.com/a/1546475/55787, and I found a copy of the article here: https://blog.csdn.net/hgd250/article/details/5214702
Furthermore the orginial link to the AJAX API is now broken, too. It seems that this one is closest to the original meaning: https://developers.google.com/custom-search/json-api/v1/overview?csw=1
See also this StackOverflow question:
google java api for google search

google java api for google search

Does google provide a Java server side api **(NOT java script).**I dont want the ajax api which works at clint side.
What i want is that the result returned for a keyword should return me search result in some specific data structure.Like List or set data structure.Then i want to manipulate the result according to my need in java code.
I had used such a java server site api for youtube.
They used to but is discontinued. Most likely because you can remove their ads ;-)
From Google's terms of service
You may not send automated queries of any sort to Google's system
without express permission in advance from Google.
So, no - use their AJAX API. The SAOP API is discoutinued, but I think you should be able to use it, unless it requires a key, in which case you are tied to the AJAX API
Technically, the statement quoted above doesn't mean you can't use some sort of server-side API - there are examples of that if you google around. It means you shouldn't do it, because sooner or later you will be blacklisted (banned), as violating the terms.
What you would be looking for now is the CustomSearch API:
They used to have a different API developers could use but it has been depreciated (Nov. 2009 I think) so this is a for cost service now. I am not aware how long it might have been a free service. The new API allows 100 free searches a day, but you have to be signed up for billing else anything above 100 searches will fail, here are the details:
http://code.google.com/apis/customsearch/v1/overview.html
And sorry yes, this would still be using Java Script but you could use this:
http://www.json.org/java/
There is at least a SOAP API that I'm aware of: Google SOAP Search API
I don't think Google wants 3rd parties to use their search engine for their own services/applications. You would get "we think you are a robot" error page as a result if Google thinks you are not a real person.
You can however try Google Custom Search

How to query google through desktop java app?

I'm trying to write a simple Java desktop app to query Google and get the results. I've read so many articles in the past few days. I know that I have to do it through the GWT (Google Web Toolkit), the API that Google offers to programmatically query its search engine. My problem is that the GWT seems to be useful only to construct AJAX applications. I just want to write a simple desktop app. I am not interested in Javascript, XML or any server side application. Isn't there a way to do it?
Sure, take a look at this approach.
The general idea is that you make an HTTP fetch (using vanilla java.net.HttpUrlConnection or Apache HTTP Client). The magic is in the forming of the URL with the search term, and in the processing of what you get back from Google.
For the exact details on how to do this, see Google's REST search API documentation, including this section.
You can always get a license for the webservice and get the results returned through SOAP, however you did say that you were uninterested in XML. Shame, thats the quickest way. There is always doing a direct request to google through the query URL, since it uses HTTP get.

Categories

Resources