GithubHelp home page GithubHelp logo

restlab's Introduction

restlab

REST api Example Using Grails 3.2.2
Need to configure database username, password and url according to your database server in application.yml file
I use MySql server in this project

Resources URL

Controller: city

Http Method Resource URL Rest Controller Action
GET http://localhost:8080/cities Action: index
GET http://localhost:8080/cities/${id} Action: show
POST http://localhost:8080/cities Action: save
PUT http://localhost:8080/cities/${id} Action: update
DELETE http://localhost:8080/cities/${id} Action: delete

Controller: location

Http Method Resource URL Rest Controller Action
GET http://localhost:8080/cities/${cityId}/locations Action: index
GET http://localhost:8080/cities/${cityId}/locations/${id} Action: show
POST http://localhost:8080/cities/${cityId}/locations Action: save
PUT http://localhost:8080/cities/${cityId}/locations/${id} Action: update
DELETE http://localhost:8080/cities/${cityId}/locations/${id} Action: delete

City POST and PUT example

Headers { Content-Type : application/json, Accept : application/json } both for POST and PUT request

POST Resource URL => http://localhost:8080/cities

Body Content JSON

{"description": "A North Side District of BD","division": "Dhaka","name": "Jamalpur","population": 300000}

PUT Resource URL => http://localhost:8080/cities/1

Body Content JSON

{"id":1 ,"description": "A North Side District of BD","division": "Dhaka","name": "Jamalpur","population": 300000}

Location POST and PUT example

Headers { Content-Type : application/json, Accept : application/json } both for POST and PUT request

POST Resource URL => http://localhost:8080/cities/1/locations

Body Content JSON

{"lat": 23.7897,"lon": 90.3929,"postalCode": "1212","stateProvince": "Dhaka","streetAddress": "23 Gulshan","streetAddressLine2": "lane 13"}

PUT Resource URL => http://localhost:8080/cities/1/locations/1

Body Content JSON

{"id":1, "lat": 23.7897,"lon": 90.3929,"postalCode": "1212","stateProvince": "Dhaka","streetAddress": "23 Gulshan","streetAddressLine2": "lane 13"}

restlab's People

Contributors

javagrails avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.