Giter Club home page Giter Club logo

travelagency's Introduction

contacts-angularjs: JAX-RS Services Documentation

Author: Yang Lei

This example supports various RESTFul end points which also includes JSONP support for cross domain requests.

By default the base URL for services is /jboss-contacts-angularjs/rest.

HotelBookingService End Points

##CREATE

Create a new customer

/rest/customers

  • Request type: POST
  • Request type: JSON
  • Return type: JSON
  • Request example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "03322341231"}
  • Response example:
  • Success: 200 OK
  • Validation error: Collection of <field name>:<error msg> for each error
{"email":"That email is already used, please use a unique email"}

##READ

List all contacts

/rest/contacts

  • Request type: GET
  • Return type: JSON
  • Response example:
[{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "01222351231"},
 {email: "[email protected]", id: 15, firstName: "John", lastName: 'Doe', phoneNumber: "01355531212"}]

Find a contact by it's ID.

/rest/contacts/<id>

  • Request type: GET
  • Return type: JSON
  • Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "02232231231"}

##UPDATE

Edit one contact

/rest/contacts

  • Request type: PUT
  • Return type: JSON
  • Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "02232231231"}

##DELETE

Delete one contact

/rest/contacts

  • Request type: DELETE
  • Return type: JSON
  • Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "08876764343"}

##CREATE

Create a new hotel

/rest/hotels

  • Request type: POST
  • Request type: JSON
  • Return type: JSON
  • Request example:
{postcode: "DD3FF4", id: 14, name: "Wen", phoneNumber: "03322341231"}
  • Response example:
  • Success: 200 OK
  • Validation error: Collection of <field name>:<error msg> for each error
{"phoneNumber":"That phoneNumber is already used, please use a unique phoneNumber"}

##READ

List all hotels

/rest/hotels

  • Request type: GET
  • Return type: JSON
  • Response example:
[{postcode: "DD3FF4", id: 14, name: "Wen", phoneNumber: "03322341231"},
{postcode: "DD3FF4", id: 15, name: "HUA", phoneNumber: "03362341231"}]

Find a hotel by it's ID.

/rest/hotels/<id>

  • Request type: GET
  • Return type: JSON
  • Response example:
{postcode: "DD3FF4", id: 14, name: "J", phoneNumber: "03322341231"}

##UPDATE

Edit one hotel

/rest/hotels

  • Request type: PUT
  • Return type: JSON
  • Response example:
{postcode: "DG4FF4", id: 14, name: "xi", phoneNumber: "02256561231"}

##DELETE

Delete one hotel

/rest/hotels

  • Request type: DELETE
  • Return type: JSON
  • Response example:
{postcode: "DD3FF4", id: 14, name: "Wen", phoneNumber: "03322341231"}

##CREATE

Create a new booking

/rest/booking

  • Request type: POST
  • Request type: JSON
  • Return type: JSON
  • Request example:
{customId: 1, hotelId: 12, bookingDate:'2016-09-09'}
  • Response example:
  • Success: 200 OK
  • Validation error: Collection of <field name>:<error msg> for each error
{"hotel&bookingDate":"That hotel is already booked on that day, please try another date"}

##READ

List all bookings

/rest/bookings

  • Request type: GET
  • Return type: JSON
  • Response example:
[{customId: 1, hotelId: 12, bookingDate:'2016-09-09'},
{customId: 2, hotelId: 13, bookingDate:'2016-09-10'}]

Find a hotel by it's ID.

/rest/hotels/<id>

  • Request type: GET
  • Return type: JSON
  • Response example:
{customId: 1, hotelId: 12, bookingDate:'2016-09-09'}

##UPDATE

Edit one booking

/rest/bookings

  • Request type: PUT
  • Return type: JSON
  • Response example:
{customId: 1, hotelId: 12, bookingDate:'2016-09-09'}

##DELETE

Delete one booking

/rest/bookings

  • Request type: DELETE
  • Return type: JSON
  • Response example:
{customId: 1, hotelId: 12, bookingDate:'2016-09-09'}

travelagency's People

Contributors

oleilea avatar

Watchers

James Cloos 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.