I am currently using a Google Map with a Fusion Table Layer. With this map, I make AJAX queries that populate the map and a list with results.
Recently there's been an issue with the Google Map API response coming back as a 400 "Malformed Request" error. This response sporadically happens when the map is populated with a new result set after filters are set and sent via AJAX. When checking out the error Firefox's debugging console, I noticed that the pb parameter may be the issue. The problem is that I'm unsure about what exactly is malformed about this parameter.
Here's the GET request that errors out:
https://maps.googleapis.com/maps/vt?pb=[...insert_param_code_here...]&callback=_xdc_._n2pwun&token=20077
I pasted what I see assigned to the pb parameter below. This is what is sent when one of the 'invalid' queries are made.
"!1m4!1m3!1i13!2i2042!3i3139!1m4!1m3!1i13!2i2043!3i3139!1m4!1m3!1i13!2i2042!3i3140!1m4!1m3!1i13!2i2042!3i3141!1m4!1m3!1i13!2i2043!3i3140!1m4!1m3!1i13!2i2043!3i3141!1m4!1m3!1i13!2i2042!3i3142!1m4!1m3!1i13!2i2042!3i3143!1m4!1m3!1i13!2i2043!3i3142!1m4!1m3!1i13!2i2043!3i3143!1m4!1m3!1i13!2i2044!3i3139!1m4!1m3!1i13!2i2045!3i3139!1m4!1m3!1i13!2i2046!3i3139!1m4!1m3!1i13!2i2044!3i3140!1m4!1m3!1i13!2i2044!3i3141!1m4!1m3!1i13!2i2045!3i3140!1m4!1m3!1i13!2i2045!3i3141!1m4!1m3!1i13!2i2044!3i3142!1m4!1m3!1i13!2i2044!3i3143!1m4!1m3!1i13!2i2045!3i3142!1m4!1m3!1i13!2i2045!3i3143!1m4!1m3!1i13!2i2046!3i3140!1m4!1m3!1i13!2i2046!3i3141!1m4!1m3!1i13!2i2046!3i3142!1m4!1m3!1i13!2i2046!3i3143!2m21!1e2!2sft:tableID!4m2!1ssg!2s%20Cities_With_Charters%20%3D%20'East%20St.%20Louis%20Area'%20AND%20Students_Served%20LIKE%20'%25'%20AND%20School_Type_Dropdown%20IN%20('Charter')%20ORDER%20BY%20School_Name%20ASC!4m2!1ssc!2sSchool_Info_ID%2C%20CPS_ID%2C%20RCDTS%2C%20School_Name%2C%20Street_Address%2C%20City%2C%20State%2C%20Zip%2C%20Phone%2C%20Website%2C%20Lat%2C%20Long%2C%20Year_Opened%2C%20School_Description%2C%20District_Info_ID%2C%20District_Name%2C%20Charter_Renew_YR%2C%20Network_ID%2C%20Network%2C%20Community_Area%2C%20State_Rep_District%2C%20State_Sen_District%2C%20Ward_Remapped%2C%20Grades_Served%2C%20Grades_Capacity%2C%20Serves_ES%2C%20Serves_HS%2C%20Serves_MS%2C%20Serves_Dropouts%2C%20School_Type_Dropdown%2C%20School_Type_Color%2C%20School_Type_Display%2C%20Profile_Type%2C%20SQRP_Rating%2C%20SQRP_Profile%2C%20Cities_With_Charters%2C%20Link_IIRC%2C%20Students_Served!4m2!1ssq!2s'School_Type_Color'%20%3D%20'GREEN'$'School_Type_Color'%20%3D%20'ORANGE'$'School_Type_Color'%20%3D%20'BLUE'$'School_Type_Color'%20%3D%20'MAGENTA'!4m2!1sc!2si:grn_blank$i:orange_blank$i:ltblu_blank$i:purple_blank!4m2!1sy!2s2!4m2!1stmplt!2s2!5i1!3m3!2sen-US!3sUS!5e18!4e3!12m1!5b1"
Here is the query without URL encoding just for reference:
SELECT School_Info_ID, CPS_ID, RCDTS, School_Name, Street_Address, City, State, Zip, Phone, Website, Lat, Long, Year_Opened, School_Description, District_Info_ID, District_Name, Charter_Renew_YR, Network_ID, Network, Community_Area, State_Rep_District, State_Sen_District, Ward_Remapped, Grades_Served, Grades_Capacity, Serves_ES, Serves_HS, Serves_MS, Serves_Dropouts, School_Type_Dropdown, School_Type_Color, School_Type_Display, Profile_Type, SQRP_Rating, SQRP_Profile, Cities_With_Charters, Link_IIRC, Students_Served FROM tableID WHERE Cities_With_Charters = 'East St. Louis Area' AND Students_Served LIKE '%' AND School_Type_Dropdown IN ('Charter') ORDER BY School_Name ASC
The steps I've taken so far to fix this:
- Making sure any query string sent to Fusion Tables has been sent with URL encoding.
- Made sure to check my quotes and quotation marks and make sure there weren't any stray ones in the query being sent.
- Checked my Google Map init parameters to make sure I didn't make any typos or add any non-existent parameters.
Are there any other precautions I'm missing in making sure malformed content isn't sent?