Gradle Script to make a REST call (POST, GET)
I am trying gradle
for the first time.
I want to call some REST API in a gradle script and check some of the responses I get.
The current system configurations include Java 1.7
, Gradle 2.4
running onOracle Linux 6.5
My REST API
:
API => POST localhost / Assign
JSON input:
{"user":"dummyuser"}
JSON output:
{
"jobMessageDetails": "dummyuser has been assigned to dummymachine",
"jobStatusDetails": "Success",
"jobType": "assign",
"machineName": "dummymachine",
"time": "2015/6/8 @ 14:47:42",
"userName": "dummyuser"
}
I can check my APIs
using POSTMAN
another computer. I do it this way: POST
hostname??:5500/Assign
JSON_INPUT
using POSTMAN
. They are working correctly.
What I want to do:
- I want to call this
API
fromgradle
script. - I want to parse the JSON_OUTPUT I am getting.
- I want to read and print to
"jobStatusDetails"
and"machineName"
from the response I received.
PS: I am very new to Gradle, I would appreciate a complete working code .
I have looked at the following links - link1 link2 . None of them helped me.
source to share
No one has answered this question yet
See similar questions:
or similar: