Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 996 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 996 Bytes

Groovy REST examples

Install groovy

brew install groovy    

Add GROOVY_HOME to .bashrc, .zshrc

export GROOVY_HOME=/usr/local/opt/groovy/libexec

Install dependency (optional)

grape install org.codehaus.groovy.modules.http-builder http-builder 

Content Type in Groovy

In examples using static variable contentType with value JSON.

Get examples

$ groovy get.groovy

Status: 200
Content Type: application/json
Body:
[
    {
        "id": 1,
        "title": "Jogging in park"
    },
    {
        "id": 2,
        "title": "Pick-up posters from post-office"
    }
]