I am making an API call to Facebook, using the Facebook C# SDK, and I can't seem to send long query strings via HTTP GET. I need a long FQL query (select .. from .. where .. in ) to execute and I can't seem to send it. If the query is smaller, it does send successfully and return the results. Unfortunatelly, as FQL supports GET and not POST, I am stuck to GET.
How can I increase the default query string limit in Windows Phone HttpWebRequest?
I am using Windows Phone SDK 7.1, but testing on Windows Phone 8 device.
It seems you need to switch to http post (if possible) or optimize your request somehow.
Read What is the maximum length of a URL in different browsers?. While the official standard for HTTP says that there should be no maximum, in reality there are maximums. For example, IE have an upper bound of 2083 characters. Windows Phone seems to have similar limit to IE.
Microsoft Internet Explorer has a maximum uniform resource locator
(URL) length of 2,083 characters. Internet Explorer also has a maximum
path length of 2,048 characters. This limit applies to both POST
request and GET request URLs.
If you are using the GET method, you are limited to a maximum of 2,048
characters, minus the number of characters in the actual path.
However, the POST method is not limited by the size of the URL for
submitting name/value pairs. These pairs are transferred in the header
and not in the URL.
RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify
any requirement for URL length.
Source: http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/f96622fe-4dcb-4d38-8831-4cfad1aa4a06/
Related
I am looking at integrating Plivo with our platform to make outgoing text to speech calls. All of our calls made, will be a customized message of about 20 words, or less than a 30 second call.
Daily, we'll batch about 10,000 calls at the same time. It appears I would have to make 10,000 rest API calls vs being able to send a batch at one time, each one with it's own answer_url. Does anyone have experience with this, seems like a ton of overhead.
Another option may be to use parameters in the answer_url, so I can send a list of all phone numbers at once and then based on a parameterized answer_url, tell Plivo what to do next.
With Plivo, you can make bulk outbound calls where you can specify multiple numbers and a single answer_url. See https://www.plivo.com/docs/getting-started/make-bulk-calls/ for a getting started doc.
For each call made, Plivo makes a request to that answer url with the to/from numbers (see this link for more details). Then, based on the to/from numbers, your answer_url can respond with the TTS message to be played for that particular number. You would just need to have a database where you can lookup the number to get the message to play for each request to your answer_url.
I have an application using Bing Maps API to retrieve coordinates for a postal code and then I perform spatial queries based on the result. There are times where I get empty results, but when I wait a few minutes it succeeds. I added logic that retried a handful of times if there's a failure but that doesn't seem to be helping. Here's the empty result I get back:
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2014 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":0,"resources":[]}],"statusCode":200,"statusDescription":"OK","traceId":"7a6bfca3f89b4f94a4693a410da4feb7|CH10043840|02.00.107.2300|CH1SCH050102529"}
And here's the URL I'm calling:
http://dev.virtualearth.net/REST/v1/Locations?q=50613&o=json&key=MyApiKey
Is there a way I can retrieve further information based on the traceId? Or is this something that's just accepted when using Bing Maps API?
You should firstly check the number of requests you're doing in a specific time and put it in relation with the type of Bing Maps Key you're using. Basic keys are rate limited which means that if you exceed the allowed number of request in a specific duration, you will be blocked.
Bing Maps Trial and basic key and rate limitation information
Those types of key are rate limited for security and logicial reasons (on 24h period and with time between the request) and that's the reason why you're getting a blank response without any information regarding the fact that it failed to geocode.
See the Terms of Use regarding the limitations and other restrictions (load and stress tests as well as hammering are part of it): http://www.microsoft.com/maps/product/terms.html
So, in order to try to analyze where your problem comes from, you might:
Check the type of key you're using and how many calls you're making on a specific period
Check the header of the response, it should include a specific header value: X-MS-BM-WS-INFO set to 1 if you are rate limited
See the MSDN about error handling: http://msdn.microsoft.com/en-us/library/ff701703.aspx
If you're not in this case (if you have an enterprise account), reach the technical support so they can officialy get back to you and check the key.
I'm currently working with an API that receives all the data sent to it via query strings. Some of the query strings I have to send are rather long and the request just dies with an unknown exception, I assume because they exceed the maximum length.
The ideal solution would be to switch to using POST data but as I don't control the API I'd have to wait until the owners of the API can update it.
Is there a way to increase the maximum query string length on Windows Phone to get around this?
I wasn't able to find a solution to this so we're asking the API vendor to switch to POST data.
For reference (as I wasn't able to find this information anywhere) Windows Phone doesn't seem to be able to make requests to URLs over 2078 characters long.
I am trying to send a very long POST request as an AJAX call in my application. Up until the query length exceeds ~7585 characters (incl. page name) the request goes through fine. However, there is a definite limit going on as adding a single character will make the request fail.
I have ensured that the tomcat server.xml config does not specify maxPostSize, and the documentation says it defaults to 2MB, which is way more room than I am using.
Am I missing something here? I am suspicious that this is a limitation being imposed by the web browser (Firefox 3.6.18).
If this is just an unfortunate truth, how do people get around this? By batching the data into smaller chunks manually? It seems like this would be a common problem for people. Thanks!
This question already has answers here:
Maximum length of HTTP GET request
(7 answers)
Closed 6 years ago.
Is there a limit to the length of a GET request?
Not in the RFC, no, but there are practical limits.
The HTTP protocol does not place any a priori limit on the length of
a URI. Servers MUST be able to handle the URI of any resource they
serve, and SHOULD be able to handle URIs of unbounded length if they
provide GET-based forms that could generate such URIs. A server
SHOULD return 414 (Request-URI Too Long) status if a URI is longer
than the server can handle (see section 10.4.15).
Note: Servers should be cautious about depending on URI lengths
above 255 bytes, because some older client or proxy implementations
may not properly support these lengths.
This article sums it up pretty well
Summary: It's implementation dependent, as there is no specified limit in the RFC. It'd be safe to use up to 2000 characters (IE's limit.) If you are anywhere near this length, you should make sure you really need URIs that long, maybe an alternative design could get around that.
URIs should be readable, even when used to send data.
As Requested By User Erickson, I Post My comment As Answer:
I have done some more testing with IE8, IE9, FF14, Opera11, Chrome20 and Tomcat 6.0.32 (fresh installation), Jersey 1.13 on the server side. I used the jQuery function $.getJson and JSONP. Results: All Browsers allowed up to around 5400 chars. FF and IE9 did up to around 6200 chars. Everything above returned "400 Bad request". I did not further investigate what was responsible for the 400. I was fine with the maximum I found, because I needed around 2000 chars in my case.
The specification does not limit the length of an HTTP Get request but the different browsers implement their own limitations. For example Internet Explorer has a limitation implemented at 2083 characters.
W3C unequivocally disclaimed this as a myth here
http://www.w3.org/2001/tag/doc/get7#myths
setFixedLengthStreamingMode(int) with contentLength parameters could set the fixed length of a HTTP request body.