What's The Quickest Way To Write A Simple Browser Client To Talk To A Rest Server
I'd like to create a simple browser client that I'll to demo the REST API we have implemented on a server. I need basic functionality like Create an item on server using POST: cli
Solution 1:
If you want to write javascript and html/css UI to run in a browser, you could use jQuery and its ajax methods.
$(document).ready(function() {
$.get("your/restful/url/here", function(data) { // do stuff with data here});
$.post("your/restful/url/here", function(data) { // do stuff with data here});
});
You could extend the above even further like this:
$(document).ready(function() {
$("post").click(function() {
$.post("/restful/?parm1=" + $("#input1").val() + "&parm2=" + $("#input2").val() , function(data) { // do stuff with data here});
});
});
<inputtype="text"id="input1" /><inputtype="text"id="input2" /><inputtype="submit"id="post">Post</input>
Also, as pointed out in the comments, you could also just simply use your browser to open your RESTful urls.
Solution 2:
You can use any of the REST server examples (C#, Java, PHP and node.js) I introduced in my blog. The good thing about these example is that they all expose XML descriptor of the API that could be used later to generate client libraries in many coding languages using Kaltura generator, including type-script, javascript and other front-end coding languages that may meet your needs.
Post a Comment for "What's The Quickest Way To Write A Simple Browser Client To Talk To A Rest Server"