使用HTML GET方法的RESTful API [英] RESTful API using the HTML GET method

查看:423
本文介绍了使用HTML GET方法的RESTful API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对代码很陌生,但我正试图尽快完成基础知识。我已经获得了一个项目,我很少知道如何实现。我有几个网站,但我需要实现一个页面,可以使用HTML GET方法访问RESTful API,JSON根据访问者选择检索数据,这些选择是使用我的API代码自动提交给REST的。我之前从未这样做过,我对JavaScript的知识非常有限,并且有学习的热情但不幸的是我有时间限制来完成这个。



我是朋友建议你们大家都很乐意帮助像我这样的初学者。从文档中我可以看到,我提供了API代码,该请求是通过特定的周边向uri发出的,这些周边指定了你想要从REST中撤回的内容。



如果有人通过将我的API代码放在.cfg文件中然后将相关周边区域修改为GET数据来修改我可以调整的代码吗?



非常感谢帮助





Vincent

I am very new to code but am trying to get through the basics as quickly as I can. I have been landed with a project that I have very little idea how to implement. I have several websites which I have done, but I need to implement a page that can access a RESTful API using the HTML GET method and JSON to retrieve data based on visitors selections which are automatically submitted to the REST using my API code. I have never done this before, I have a very limited knowledge on JavaScript and have a passion to learn but unfortunately I have a time restraint to finish this.

I was advised by a friend that you folks are very accomodating to assist beginners like myself. From what I can see in the documentation I was supplied with the API code that the requests are made to a uri with certain perimeters that specify what you want to retreave from the REST.

If there anyone that has some code that I could adapt by placing my API code in the .cfg file and then modifying the relavent perimeter areas to GET data?

Assistance would be greatly appreciated


Vincent

推荐答案

基本上你想要的是一个JavaScript代码,它会向一些web API发送请求并接收JSON响应。

首先我不确定你的网站是否已经使用了一些JavaScript库,例如jQuery,如果他们这样做,那么请注意有很多样本显示如何做到这一点[ ^ ]。



现在万一你正在寻找一个plai n JavaScript解决方案(没有任何其他库),那么您需要这个
Hi, basically what you want is a JavaScript code that would send a request to some web API and receive a JSON response.
First I'm not sure if your sites already use some JavaScript library, for example jQuery, in case they do then note that there are quite a lot of samples showing how to do accomplish this [^].

Now in case you are looking for a plain JavaScript solution (without any additional libraries) then you would need something like this.

这篇关于使用HTML GET方法的RESTful API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆