Innov-AI
    Documentation | MentDB Weak Server
Call secure or not external REST API (methode POST/PUT/DELETE/GET) without JSON body

  • Example 1: Call a http simple request:
  • rest http get "http://prod.innov-ai.com/demo/" "" "{}" "[]";
  • "{
      \"reponse\": \"\u003c!doctype html\u003e\t\t\u003chtml lang\u003d\\"fr\\"\u003e\t\t\u003chead\u003e\t\t  \u003cmeta charset\u003d\\"utf-8\\"\u003e\t\t  \u003ctitle\u003eDemonstration\u003c/title\u003e\t\t  \u003clink  href\u003d\\"css/style.css\\" rel\u003d\\"stylesheet\\"\u003e\t\t  \u003clink href\u003d\\"dist/css/bootstrap.css\\" rel\u003d\\"stylesheet\\"\u003e\t\t  \u003clink rel\u003d\\"icon\\" type\u003d\\"image/png\\" href\u003d\\"images/bar_icon.png\\" /\u003e\t\t\u003c/head\u003e\t\t\u003cbody id\u003d\\"body\\" style\u003d\u0027background-image: url(images/bg.png);background-size: contain;margin:0px;color:#333;font-family: Roboto,Helvetica Neue,Helvetica,Arial,sans-serif;;font-size: 12px;\u0027\u003e\t\t\u003cdiv id\u003d\\"login\\"\u003e\t\t  \u003cdiv id\u003d\u0027divSignInCenter\u0027\u003e\t\t      \u003cdiv id\u003d\u0027divSignIn\u0027 style\u003d\u0027border: 5px #4e4e4e solid;background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #7d7d7d), color-stop(100%, #1b1b1b)), #1b1b1b;\t\t\t      background: -webkit-linear-gradient(#7d7d7d, #1b1b1b), #3F3F3F;\t\t\t      background: -moz-linear-gradient(#7d7d7d, #1b1b1b), #3F3F3F;\t\t\t      background: -o-linear-gradient(#7d7d7d, #1b1b1b), #3F3F3F;\t\t\t      background: linear-gradient(#7d7d7d, #1b1b1b), #3F3F3F;box-shadow: 2px 0px 15px 1px #888888;\u0027\u003e\t\t          \u003ca class\u003d\u0027btn btn-primary\u0027 style\u003d\u0027background-color: #D70000;border: 0px;-webkit-border-bottom-right-radius: 0px;-webkit-border-bottom-left-radius: 0px;-moz-border-radius-bottomright: 0px;-moz-border-radius-bottomleft: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;color: #484848;display: block;width: 100%;height: 16px;line-height: 5px;\u0027 href\u003d\u0027https://prod.innov-ai.com:9999\u0027\u003e\u003cimg style\u003d\u0027margin-top:-3px;height:10px\u0027 src\u003d\u0027images/mt.png\u0027\u003e\u003c/a\u003e\t\t          \u003cdiv id\u003d\u0027divSignInImg\u0027 style\u003d\u0027padding-top: 35px;\u0027\u003e\u003ca href\u003d\u0027index.jsp\u0027\u003e\u003cimg src\u003d\u0027images/logo.png\u0027 height\u003d\u002770px\u0027 alt\u003d\u0027\u0027\u003e\u003c/a\u003e\u003c/div\u003e\t\t          \u003cdiv style\u003d\u0027padding:5px;font-size: 16px;color:#fff;border-bottom: 1px #696969 solid;\u0027\u003e\u003cb\u003eDemonstration\u003c/b\u003e\u003cbr\u003e\u0026nbsp;\u003c/div\u003e\t\t          \u003cdiv id\u003d\u0027connectError\u0027 style\u003d\\"color:#F00;min-height:25px\\"\u003e\u003c/div\u003e\t\t          \u003cform action\u003d\u0027index.jsp\u0027 method\u003d\u0027post\u0027\u003e\t\t              \u003cinput class\u003d\u0027style-1\u0027 type\u003d\u0027text\u0027 placeholder\u003d\u0027User\u0027 name\u003d\u0027x-user\u0027 id\u003d\u0027x-user\u0027 autofocus\u003e\u003cbr\u003e\t\t              \u003cinput class\u003d\u0027style-1\u0027 type\u003d\u0027password\u0027 placeholder\u003d\u0027Password\u0027 name\u003d\u0027x-password\u0027 id\u003d\u0027x-password\u0027\u003e\t\t              \u003cinput type\u003d\\"submit\\" class\u003d\u0027btn btn-light\u0027 style\u003d\u0027padding: 5px 30px 5px 30px;margin-top: 10px;width: 200px;height: 35px;\u0027 value\u003d\\"Login\\"\u003e\t\t              \u003cdiv style\u003d\u0027height:25px\u0027\u003e\u003c/div\u003e\t\t          \u003c/form\u003e\t\t      \u003c/div\u003e\t\t      \u003cdiv style\u003d\u0027margin-top: 10px;color:#FFF\u0027\u003e\u0026copy; 2012 - 2023 - \u003ca href\u003d\u0027https://www.mentdb.org\u0027 style\u003d\u0027color:#fff\u0027 target\u003d\u0027_blank\u0027\u003e\u003cb\u003eMentDB\u003c/b\u003e\u003c/a\u003e\u003c/div\u003e\t\t  \u003c/div\u003e\t\t\u003c/div\u003e\t\t\u003c/body\u003e\t\t\u003c/html\u003e\",
      \"reponse_header\": [
        \"Key : null ,Value : [HTTP/1.1 200 OK]\",
        \"Key : Server ,Value : [Jetty(9.2.2.v20140723)]\",
        \"Key : Set-Cookie ,Value : [JSESSIONID\u003d1csa1zrttc0rj1ekxjiun6m7ap;Path\u003d/demo]\",
        \"Key : Expires ,Value : [Thu, 01 Jan 1970 00:00:00 GMT]\",
        \"Key : Content-Length ,Value : [2566]\",
        \"Key : Date ,Value : [Mon, 07 Aug 2023 05:28:19 GMT]\",
        \"Key : Content-Type ,Value : [text/html; charset\u003dUTF-8]\"
      ],
      \"cookies\": [
        \"JSESSIONID\u003d1csa1zrttc0rj1ekxjiun6m7ap;Path\u003d/demo\"
      ]
    }";
  • The result is in 'reponse' key
  • If it is a JSON, the JSON is included into the global JSON, else it is a string...
  • To call a https or POST/PUT/DELETE:
  • rest http|https get|post|put|delete "http://prod.innov-ai.com/demo/" "" "{}" "[]";
  • Example 2: call a MentDB Web-Service (AUTO-REST API)
  • json load "header" "{}";
    json iobject "header" / "x-user" "admin" STR;
    json iobject "header" / "x-password" "pwd" STR;
    rest https get "https://localhost:9999/api/addition" "v1=1&v2=6" (json doc "header") "[]";
  • Example 3: Website Browser
  • json load "response_1" (rest https post "https://localhost:8083/demo/index.jsp" "x-user=system&x-password=pwd" "{}" "[]");
    json load "response_2" (rest https post "https://localhost:8083/demo/index.jsp" "x-user=system&x-password=pwd" "{}" (json select "response_1" "/cookies"));
    json doc "response_2";
Services     Supporters     Contact     About     Legal notice © 2024