Skip to content

Commit 7bb87a9

Browse files
authored
Adjusting rest connection (#4940)
1 parent 8339b87 commit 7bb87a9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

docs/developer-guide/io.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,21 +1317,21 @@ The `Rest` API makes it easy to invoke a restfull webservice without many of the
13171317

13181318
[source,java]
13191319
----
1320-
Map<String, Object> jsonData = Rest.get(myUrl).getAsJsonMap();
1320+
Map<String, Object> jsonData = Rest.get(myUrl).getAsJsonMap().getResponseData();
13211321
----
13221322

13231323
For a lot of REST requests this will fail because you need to add an HTTP header indicating that you accept JSON results. you've a special case support for that:
13241324

13251325
[source,java]
13261326
----
1327-
Map<String, Object> jsonData = Rest.get(myUrl).acceptJson().getAsJsonMap();
1327+
Map<String, Object> jsonData = Rest.get(myUrl).acceptJson().getAsJsonMap().getResponseData();
13281328
----
13291329

13301330
You can also do POST requests as easily:
13311331

13321332
[source,java]
13331333
----
1334-
Map<String, Object> jsonData = Rest.post(myUrl).body(bodyValueAsString).getAsJsonMap();
1334+
Map<String, Object> jsonData = Rest.post(myUrl).body(bodyValueAsString).getAsJsonMap().getResponseData();
13351335
----
13361336

13371337
Notice the usage of post and the body builder method. There are MANY methods in the builder class that cover pretty much everything you would expect and then some when it comes to the needs of rest services.

0 commit comments

Comments
 (0)