HTTP GET and POST functions for REST APIs in Node.js

On getting the GET request from the client, the server responds, by revealing some information about itself, and metadata about the data asked by the client. The response from REST API which is in the form of URL can be obtained by implementing an http get method. 

NodeJs: HTTP Request – Response to REST API

Sending HTTP GET/POST Request and Response using Node JS. Code: var https = require("https"); exports.handler = (events,context,callback) => { var options = { host : 'hostname', port : '443', path : 'ifany', headers: { 'Authorization' : 'Basic' + new Buffer("username" + ':' + "password").toString('base64') } }; // request request = https.get(options, function(res){ var body = … Continue reading NodeJs: HTTP Request – Response to REST API

Sending HTTP GET Request to a REST API in JAVA

HTTP/HTTPS Get/Post request /response using JAVA below. For detailed visit here: https://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/ Code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import javax.net.ssl.HttpsURLConnection; public class HttpURLConnection { public static void main(String[] args) throws IOException { String response = httpGet("https://services.groupkt.com/state/get/IND/all"); } public static String httpGet(String urlStr) throws IOException { URL obj = new URL(urlStr); HttpsURLConnection con … Continue reading Sending HTTP GET Request to a REST API in JAVA