Skip to main content

Posts

Showing posts from October, 2017

How to Installation Kong Service

INSTALLATION PROCESS: $ sudo apt-get update $ sudo apt-get install openssl libpcre3 procps perl $ sudo dpkg -i kong-0.10.3.*.deb CONFIGURE YOUR DATABASE : Configure Kong so it can connect to your database. Kong supports both PostgreSQL 9.4+ and Cassandra 3.x.x as its datastore. If you are using Postgres, please provision a database and a user before starting Kong, ie: CREATE USER kong; CREATE DATABASE kong OWNER kong; START KONG: $ kong start  # Kong is running $ curl 127.0.0.1:8001 ISSUE THE FOLLOWING COMMAND TO START KONG: $ kong start Note: The CLI also accepts a configuration (-c <path_to_config>) option allowing you to point to different configurations. VERIFY THAT KONG HAS STARTED SUCCESSFULLY : The previous step runs migrations to prepare your database. Once these have finished you should see a message (Kong started) informing you that Kong is running. By default Kong listens on the following ports: :8000 on which Kong listens for incoming HTTP tr

How to Unirest HTTP API Requests Call in Java

Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by Mashape, who also maintain the open-source API Gateway Kong. Do yourself a favor, and start making HTTP requests like this: Creating Function : /** * Unirest API call return jsonResponse handle * Function Name: ApiCallFunction * @param vEmail, Url * @return status */ public static String ApiCallFunction(String vEmail, String Url) { try{ HttpResponse<JsonNode> jsonResponse = Unirest.post(Url) .field("vEmail",vEmail) .asJson(); JSONObject output= jsonResponse.getBody().getObject(); String status= output.getString("status"); return status; }catch(UnirestException e){ return "error"; } } Type Of   Response Handle : // Response to String Sting bookResponse = Unirest.get(Url).asString(); //Respo

How to Write Orientdb Function in Language JavaScript

Creates a new Server-side javascript function. You can execute  Functions  from SQL, HTTP and Java. Syntax : CREATE FUNCTION < name > <code> [ PARAMETERS [<comma-separated list of parameters ' name>]] [IDEMPOTENT true|false] [LANGUAGE <language>] <name>  Defines the function name. <code>  Defines the function code. PARAMETERS  Defines a comma-separated list of parameters bound to the execution heap. You must wrap your parameters list in square brackets []. IDEMPOTENT  Defines whether the function can change the database status. This is useful given that HTTP GET can call  IDEMPOTENT  functions, while others are called by HTTP POST. By default, it is set to  FALSE . LANGUAGE  Defines the language to use. By default, it is set to JavaScript. Examples: Create Vertex Node : /* @ADD Function * Function name : createVertex * Language : javascript * Idempotent : true @Add new para