<!DOCTYPE html><!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>How does APIJSON works? — APIJSON Docs 1.0.0 documentation</title><script type="text/javascript" src="../_static/js/modernizr.min.js"></script><script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script><script type="text/javascript" src="../_static/jquery.js"></script><script type="text/javascript" src="../_static/underscore.js"></script><script type="text/javascript" src="../_static/doctools.js"></script><script type="text/javascript" src="../_static/language_data.js"></script><script type="text/javascript" src="../_static/contentui.js"></script><script type="text/javascript" src="../_static/js/theme.js"></script><link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /><link rel="stylesheet" href="../_static/pygments.css" type="text/css" /><link rel="stylesheet" href="../_static/css/custom.css" type="text/css" /><link rel="stylesheet" href="../_static/contentui.css" type="text/css" /><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="What APIJSON has achieved?" href="what_achieved.html" /><link rel="prev" title="API design style guide" href="design_rules.html" /></head><body class="wy-body-for-nav"><div class="wy-grid-for-nav"><nav data-toggle="wy-nav-shift" class="wy-nav-side"><div class="wy-side-scroll"><div class="wy-side-nav-search" ><a href="../index.html" class="icon icon-home"> APIJSON Docs</a><div role="search"><form id="rtd-search-form" class="wy-form" action="../search.html" method="get"><input type="text" name="q" placeholder="Search docs" /><input type="hidden" name="check_keywords" value="yes" /><input type="hidden" name="area" value="default" /></form></div></div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"><p class="caption"><span class="caption-text">Quick Start</span></p><ul><li class="toctree-l1"><a class="reference internal" href="../quick_start/introduction.html">About APIJSON</a></li><li class="toctree-l1"><a class="reference internal" href="../quick_start/features.html">Features</a></li><li class="toctree-l1"><a class="reference internal" href="../quick_start/server_deployment/server_deployment.html">Server-side Deployment</a></li><li class="toctree-l1"><a class="reference internal" href="../quick_start/client_deployment/client_deployment.html">Client-side Deployment</a></li></ul><p class="caption"><span class="caption-text">Documentation</span></p><ul class="current"><li class="toctree-l1"><a class="reference internal" href="design_rules.html">API design style guide</a></li><li class="toctree-l1 current"><a class="current reference internal" href="#">How does APIJSON works?</a></li><li class="toctree-l1"><a class="reference internal" href="what_achieved.html">What APIJSON has achieved?</a></li></ul></div></div></nav><section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="top navigation"><i data-toggle="wy-nav-top" class="fa fa-bars"></i><a href="../index.html">APIJSON Docs</a></nav><div class="wy-nav-content"><div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation"><ul class="wy-breadcrumbs"><li><a href="../index.html">Docs</a> »</li><li>How does APIJSON works?</li><li class="wy-breadcrumbs-aside"><a href="../_sources/documentation/why.rst.txt" rel="nofollow"> View page source</a></li></ul><hr/></div><div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"><div itemprop="articleBody"><div class="section" id="how-does-apijson-works"><h1>How does APIJSON works?<a class="headerlink" href="#how-does-apijson-works" title="Permalink to this headline">¶</a></h1><p>APIJSON-Server will turn JSON formatted requests to SQL statements. Then as the database has been connected, those SQL statements will be executed. The server will return specified resources in JSON. During the whole process, APIJSON automatically verify the user’s role and permissions, which will prevent malicious SQL injection.</p><p>You can also set restrictions on the request content by set rules in the database beforehand. For instance, to verify if the value of <code class="code docutils literal notranslate"><span class="pre">type{}</span></code> would be one of <code class="code docutils literal notranslate"><span class="pre">[0,1,2]</span></code>, you just need to add the following in the database:</p><div class="highlight-json notranslate"><div class="highlight"><pre><span></span>"VERIFY":{"type{}":[0,1,2]}</pre></div></div><p>Others that are used to verify requests include:</p><div class="highlight-json notranslate"><div class="highlight"><pre><span></span>"VERIFY": { "money&{}":">0,<=10000" } //To verify if the value if money is between 0 and 10000."TYPE": { "balance": "Double" } //To verify if the data type of the "balance" is "Double"."UNIQUE": "phone" //The value of "phone" must be unique."NECESSARY": "id,name" //"id" and "name" must be included in the request body."DISALLOW": "balance" //"Balance" is not allowed to be included in the request body."INSERT": { "@role": "OWNER" } //If the "role" is not included in the request, the system will assign one by default."UPDATE": { "id@": "User/id" } //To force to insert a key-value pair.</pre></div></div><p>To see a full list of key words that used to set constraints on requests or verify requests, <a class="reference external" href="https://github.com/APIJSON/APIJSON/blob/master/APIJSON-Java-Server/APIJSONORM/src/main/java/zuo/biao/apijson/server/Operation.java">click here</a>.</p></div></div></div><footer><div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"><a href="what_achieved.html" class="btn btn-neutral float-right" title="What APIJSON has achieved?" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a><a href="design_rules.html" class="btn btn-neutral float-left" title="API design style guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a></div><hr/><div role="contentinfo"><p>© Copyright 2019, Ruoran Wang</p></div>Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.</footer></div></div></section></div><script type="text/javascript">jQuery(function () {SphinxRtdTheme.Navigation.enable(true);});</script></body></html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。