414 Request-URI Too Long
Hey all,
After completing a customisation with the very helpful VikasB over on this thread https://community.lithium.com/t5/Developer-Discussion/Post-a-new-topic-to-a-specific-board-via-API/m-p/324909#M12683 I have since put my code live and the users are making good use of it. Well.. almost too much use of it as they immediately started trying to report the type of posts that were very lengthy in its content.
I took a look at the console in my dev tools and found the following error:
NetworkError: 414 Request-URI Too Long
and the response from the header is
Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.
Is there a way around this? The api docs say that the limit is 1,000,000 characters which is plenty of room so not sure why this would happen. Do I need to limit the api call or convert it to a V2 api? Not sure what to do with it :(
Thanks,
Jack
You can use Post call instead.
Instead of putting the data on the URL you should be putting it in the body of a POST request. You need to add a data value to the object you're passing to the ajax function call. Like this:
$.ajax({ url: dest_url, type:"post", async: false, data: { about: about }, success: function(response){ }, error:function(xhr, ajaxOptions, thrownError){alert(xhr.responseText); ShowMessage("??? ?? ?????? ??????? ????","fail");} });