Skip to content

Using JSON example

Tambapps edited this page Apr 14, 2021 · 2 revisions

Here is an example to configure the client to use JSON

poet = new HttpPoet(url: "https://jsonplaceholder.typicode.com", 
  contentType: ContentType.JSON, acceptContentType: ContentType.JSON)
def todo = poet.get("/todos/1")
println(todo)

poet.post("/posts", body: [title: 'foo', body: 'bar', userId: 1])
Clone this wiki locally