(414) Request-URI Too Large

590 views
Skip to first unread message

Luca

unread,
Jul 26, 2011, 6:39:16 AM7/26/11
to Google AJAX APIs
Hello, i'm using google api translate for dot.net.

this is my code:

Protected Sub bb_Traduci_Click(sender As Object, e As EventArgs)
Handles bb_Traduci.Click
Dim Translator As New TranslateClient("")
Try
CKEditorControl_en.Text =
Translator.Translate(CKEditorControl_it.Text, "it", "en")
Catch ex As Exception
common_mail.segnalazione(Request.Url.ToString, "Google API
traslate error: " & ex.ToString)
Exit Sub
End Try
End Sub

For long text i received....the server message in subject.
How can i do solve this problems?

Jeremy Geerdes

unread,
Jul 26, 2011, 9:14:27 AM7/26/11
to google-ajax...@googlegroups.com
I suspect that you're sending this to the Translate API v2 since the last time I checked, the v1 API just didn't respond to URI's that are too long. In either case, the solution is to use the POST method, but note that to do so, you must also send a custom header. It's all in the documentation.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Luca

unread,
Jul 26, 2011, 12:32:37 PM7/26/11
to Google AJAX APIs
i'm using version 0.4.0.133 of GoogleTranslateAPI
i didn't find anything in documentation for dot.net about
how to use post method and send a customheader.

this code is the only thing i do:
mystring.Text = Translator.Translate(mystring.Text, "it", "en")



On Jul 26, 3:14 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> I suspect that you're sending this to the Translate API v2 since the last time I checked, the v1 API just didn't respond to URI's that are too long. In either case, the solution is to use the POST method, but note that to do so, you must also send a custom header. It's all in the documentation.
>
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
>
> For more information or a project quote:
> jrgeer...@gmail.com
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!
>
> On Jul 26, 2011, at 5:39 AM, Luca wrote:
>
>
>
> > Hello, i'm using google api translate for dot.net.
>
> > this is my code:
>
> >    Protected Sub bb_Traduci_Click(sender As Object, e As EventArgs)
> > Handles bb_Traduci.Click
> >        Dim Translator As New TranslateClient("")
> >        Try
> >            CKEditorControl_en.Text =
> > Translator.Translate(CKEditorControl_it.Text, "it", "en")
> >        Catch ex As Exception
> >            common_mail.segnalazione(Request.Url.ToString, "Google API
> > traslate error: " & ex.ToString)
> >            Exit Sub
> >        End Try
> >    End Sub
>
> > For long text i received....the server message in subject.
> > How can i do solve this problems?
>
> > --
> > You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> > To post to this group, send email to google-ajax...@googlegroups.com.
> > To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/google-ajax-search-api?hl=en.- Hide quoted text -
>
> - Show quoted text -

Jeremy Geerdes

unread,
Jul 26, 2011, 12:56:30 PM7/26/11
to google-ajax...@googlegroups.com
If you look at the link below, which I believe is part of the source for the plug-in you're using, you'll find that the plug-in is hard-coded to use only GET (i.e., to pass all parameters through the URL). You'll need to re-work this chunk to detect if the string you want to translate is longer than appr. 1200 characters (AFTER URI-encoding it) and, if it is, to switch to the POST method. Here's the link:

http://code.google.com/p/google-api-for-dotnet/source/browse/branches/0.3.1_Issue47/src/GoogleTranslateAPI/Translate/ILanguageService.cs

That said, please note that the Translate API v1 AND v2 are scheduled to be discontinued no later than December 2011. Google has announced that they will offer a PAID solution before that time, but they have not yet released any details of the offering. If your application is (a) intended to function beyond December and/or (b) dependent on a free Translate API, you will want to find an alternative service (e.g., Microsoft's Bing Translator API).

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

jayshr...@mrrsoft.com

unread,
Dec 14, 2015, 7:09:49 AM12/14/15
to Google AJAX APIs
Hi Jeremy,

Can you please suggest some solution for increase POST call limit for character(It is now only 5K characters)

> To unsubscribe from this group, send email to google-ajax-search-api+unsub...@googlegroups.com.

Jeremy Geerdes

unread,
Dec 14, 2015, 7:20:56 AM12/14/15
to google-ajax...@googlegroups.com

The 5000-character limit on POST requests is a hard limit. There is no workaround except to make multiple requests. There are two tricks for doing multiple requests. The first is breaking the text into chunks that contain complete sentences or clauses (i.e., don't just break the text into 5,000-character blocks; split it by paragraph or sentences or clauses). The second, assuming you're using asynchronous requests, is using method closures so you can keep track of which request goes with which source text. You can find information about method closures on the web.

Jg

> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Clay Garner

unread,
Jul 5, 2016, 7:38:14 AM7/5/16
to google-ajax...@googlegroups.com
How can I find out who a Craigslist ad belongs to?

> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Geerdes

unread,
Jul 5, 2016, 9:00:14 AM7/5/16
to google-ajax...@googlegroups.com
There is no way to do this with the Google Search API.


For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rev. Jeremy R. Geerdes, Pastor
Debra Heights Wesleyan Church
4025 Lower Beaver Rd
Des Moines, IA 50310

Reply all
Reply to author
Forward
0 new messages