0
{
    "Image": "sha256:357a02cbb63175a797ea238665bd1cfe6210f0381670d7155b034a58020a65f5",
    "NetworkSettings": {
        "IPAddress": "172.17.0.6",
        "IPPrefixLen": 16,
        "Gateway": "172.17.0.1",
        "Bridge": "",
        "PortMapping": null,
        "Ports": {
            "80/tcp": [],
            "8082/tcp": []
        },
        "MacAddress": "02:42:ac:11:00:06",
        "Networks": {
            "bridge": {
                "Aliases": null,
                "NetworkID": "08a5829cf9c451ad09c28ce5c0ab09a192e7adf845563cec4f726572d91835be",
                "EndpointID": "7f8c27eaf162c95ca932b343739bb4e08dd5efb73aa2454db64618a9b62f417e",
                "Gateway": "172.17.0.1",
                "IPAddress": "172.17.0.6",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "02:42:ac:11:00:06"
            }
        }
    }
}

I tried following ways first line gives be blank output second line of code prints network settings with blank network id.

String networkId = response.jsonPath().getString("NetworkSettings.Networks.bridge.NetworkID");

String networkId = response.jsonPath().getString("NetworkSettings);

htshame
  • 6,599
  • 5
  • 36
  • 56
Arun
  • 63
  • 1
  • 2
  • 11
  • 1
    The first one should work. Are you sure that the http request doesn't return a response with empty NetworkID? – Hristo Angelov Mar 16 '18 at 08:39
  • @Arun, @HristoAngelov is right, the first line should work. Check your `response.jsonPath()`. – htshame Mar 16 '18 at 09:09
  • when i am printing via Rest assured i am not getting any value. But via Rest Client browser plug-in i am able to see above reponse. – Arun Mar 16 '18 at 09:45
  • Rest Assured Response for "NetworkSettings.Networks.bridge [Gateway:, GlobalIPv6Address:, EndpointID:, IPPrefixLen:0, IPv6Gateway:, GlobalIPv6PrefixLen:0, Aliases:null, NetworkID:, IPAddress:, MacAddress: – Arun Mar 16 '18 at 09:47
  • @Arun could you provide your server-side code? – htshame Mar 16 '18 at 10:14
  • Hi i was passing wrong image id that's why i was getting blank Network ID. – Arun Mar 17 '18 at 13:20

0 Answers0