Trying to add documents to an elasticsearch index using Sense. eg:
POST productmarket/ppt/joe#broker.com_Index_withNewGuid_233df4
{
"hash" : "cake"
}
and I get back"
Request failed to get to the server (status code: 0):
Now if I change the # to something else it works fine.
Now we already have items in the index that have #'s in the id's. If I update them in a frontend APP we have that uses the API's to post it breaks as well eg.
BUT When I use our C# app to index a json document that has # in its id using NEST it works. And when I try and update this document again in the frontend app (where it just broke) it works as well.
Now I have tried indexing plain document and complex documents. Nothing changes. I've tried different indexes. Still the same problem.
Any idea what is wrong?
Figured it out. Pretty stupid.
Nest URL encodes the request.
Sense does not. Using the URL encoded value for # it works fine.
Related
I'm trying to implement a cache clearing button for our website that will append the Clear-Site-Data header on a specific route so we can be relatively sure that the users are getting the latest javascript, css, etc. after a release. I'm assigning the header in my ActionMethod like so:
According to developer tools, I'm getting the header on the client:
So, Chrome is trying to do what I'm asking but it's throwing an error saying the types I'm passing it are unrecognized:
Am I missing something with how I'm creating the header? Is this a bug?
Ok, so here we are a few months down the road and I finally remembered to come back and post the working solution. What I didn't understand at the time I asked the question was that the quotes are expected to be treated as literal in the response header examples I found. So the code I posted in my question was missing a few \ characters in the strings. What ended up working was this:
The headers on the client now look like this (note the quotes around cache and storage):
And the cache and localStorage are cleared as desired. Hope this helps someone else as well!
i am building a project to search for a specific driver at Lenovo Website (https://support.lenovo.com). This site changes the search URL while typing, if a suitable product category is found.
This means for example if you search for "ideapad" it uses:
http://pcsupport.lenovo.com/api_v2/de/de/Product/GetProducts?productId=ideapad
if you search for "T540p 20BE" the Url changes to:
http://pcsupport.lenovo.com/de/de/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t540p/20be?linkTrack=Homepage%3ABody_Search+Products&searchType=4&keyWordSearch=T540p%2520Laptop%2520%2528ThinkPad%2529%2520-%2520Type%252020BE
First i tried to use the url above http://pcsupport.lenovo.com/api_v2/de/de/Product/GetProducts?productId=[Searchpattern]. you get back a Json File which has further information to all modeltypes of that devices. Not the response i needed.
What i need is a way to get back all available drivers for some given Modell.
As Response to the search you get a Html Document, which contains all drivers in an embedded html page:
!]
I have tried different approches with selenium which works, but need a usabel way for my application. I tried with HTMLAgilityPack and xpath, but came not across the problem with changing search urls?
How can i get the Version and the Downloadlink ??
Update: Here is some example code. After not being able to get the correct syntax of the get Statemente, i tried to input the searchtext within the inputbox.
Goal: Be able to paste searchtext into the inputbox within the lenovo site, or overcome the changing urls (as mentioned above).
Extract the needed informations from the resulting driverpage
Edit: Just delete the unneeded code part. Can someone give me a hint for a working approach on this. If HtmlWeb is not the best solution, what would you prefer ?
You need to query for the corresponding elements and get the values you need. For example for version you need to query for the version DOM element (with tag, css class or any other attribute) and get the InnerText property. For the download links you need to query for the download element and get the href attribute.
If you have any problems during the development, add the code to the question to let us understand what you are doing and for what you are querying.
Edit: About the url search part. First of all, you need to understand that your HtmlDocument is not a browser and you cannot search products by filling the textbox in the site. You need to find other way to find the corresponding url for the inserted product. One option can be to get data from all available search urls, combine that data, and search inside of that combined one.
I have a web page that uses a webmail service to send emails. This is on an company intranet using a Microsoft Exchange server. My website created an email with a link to an image handler on my website. In my code, I can print some debug messages and I see:
<img src='http://tav.target.com/VIBEHandler.ashx?id=z064441_45975&type=Amazing'/>
But in the email, when I view the source code, I see this:
<img src="http://tav.target.com/VIBEHandler.ashx?id=z064441_45975&type=Amazing"/>
My single quotes changed to double quotes (no big deal).
&
changed to
&
This causes the URL to not work and images appear as the red "x", indicating a missing image.
How can I preserve my URL?
Your 3rd party emailing service might be converting your HTML document to a valid XML document for compatibility reasons.
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Basically, in XML, an ampersand character represents and XML entity, and can not be used unless you place the text within a CDATA node. Your 3rd party service seems to just be converting the & to & , which would work to safely display the value, but doesn't do too much for a URL.
http://www.w3schools.com/xml/xml_cdata.asp
If I were in your situation, I would URL encode the image URL when generating the HTML document that is being sent out. This way, it is both a proper link, and a valid XML string.
HttpUtility.UrlEncode(myUrlString);
http://msdn.microsoft.com/en-us/library/4fkewx0t%28v=vs.110%29.aspx
Hope this helps!
The best solution we could come up with is to use a single variable with multiple values separated with an underscore. This eliminates the need for the '&' symbol entirely and makes everything happy and compatible.
The URL is basically a link to an image handler so we can include images in emails without the use of attachments, shared drives, etc. The image handler can also do things like merge images together to create a single image (WAY better than trying to overlap images in emails which almost NEVER works). I simply added some code to the image handler that can check for and dissect the "meta-variable" in my URL.
http://sample.com?var=ONE_TWO_THREE
http://sample.com?var1=ONE&var2=TWO&var3=THREE
The URL now looks more clean and can have as many variables as I want so long as I put everything in the exact correct order, read it all in using the same sequence, don't miss anything, and document everything well. I COULD go one step farther and specify what each variable means:
http://sample.com?var=first-Nicolai_last-Dutka_age-34_etc-foobar
But that just tells the whole world what all my variables mean! Hypothetically, I could do:
http://sample.com?var=24154#kja&nl897q45pjkh8&&^HJ435
Then it would be up to me to determine where the breaking points are to bust that up into the variables:
24151, kja*, n1897, 45, etc
Of course, I'm not going to be that complex and will likely just stick to:
http://sample.com?var=ONE_TWO_THREE
Enjoy!
i integrating with an software, where they sending their document to my url with too large query string value. i.e. more than 75000 char for a parameter. i am in a R&D phase to check whether integration is works. i came to know that browsers will limit the query string. i want to get their document into to my server. i google but not get the answer. the url is in following fashion
Http:\\myurl?document=thierdocument in base64 encoded format
guide me to overcome the problem
This is not going to work. The query string is limited to a few thousand characters depending on the browser (i.e. 2083 characters for IE). Use a HTTP POST instead and put the document in binary format in the body of the request.
The main idea of a URL was to be a Uniform Resource Locator, not to pass all the data as part of the URL itself. You cannot work around the browser limits on URLs (neither should you arguably) - an alternative could be passing the document id in form of a number or Guid, then looking up that document to process as part of your page.
My suggestion is to move the data from query string, to post form.
My suggestion is to move the data from query string, to post form.
Why ?
one reason is the the url data, including your big string, is used to know if the page is going to cached by the browser or not. So I think that browser him self have a problem remeber this big string.
other reason is that this url is travel as it is, a big one, and is very possible to not reach the target.
The 2083 charatercs in IE I think that is refered only on URL, not on the included data.
You will have to do it using POST query.
Taken from What is the limit on QueryString / GET / URL parameters?
The spec for URL length does not dictate a minimum or maximum URL
length, but implementation varies by browser. On Windows: Opera
supports ~4050 characters, IE 4.0+ supports exactly 2083 characters,
Netscape 3 -> 4.78 support up to 8192 characters before causing errors
on shut-down, and Netscape 6 supports ~2000 before causing errors on
start-up.
I am trying to access movie info using themoviedb API as imdb seems like a lost cause.
They use a key which I replaced with *'s but from what I can see this should be all I need to do a simple search
so my code is very simple
TmdbAPI api = new TmdbAPI("***************************");
TmdbMovie[] movies = api.MovieSearch(batman);
But whenever I search I get the XMLParseException unless I outcomment the second line
There is a sample application, but I cant get it to run with VS2010 and I cant see how its doing the things any differently except that app reads the name of the movie from a textbox as mine will further down the road.
Looking at the issue tracker, there appears to be a problem with the returned XML since December 1st 2010 (if not earlier).