GithubHelp home page GithubHelp logo

user-java's Introduction

Overview

This server was generated by the swagger-codegen project.
By using the OpenAPI-Spec, you can easily generate a server stub.
This is an example of building a swagger-enabled server in Java using the SpringBoot framework.

The underlying library integrating swagger to SpringBoot is springfox

Start your server as an simple java application.

You can view the api documentation in swagger-ui by pointing to http://localhost:8080/api/swagger-ui.html

Change default port value in src/main/resources/application.properties

Build the project

  1. Install Maven https://maven.apache.org/install.html and setup the environment path accordingly

  2. Go into the project root directory that has the pom.xml and run mvn clean install

Run only the tests

mvn test

Run the application

  1. Modify the src/main/resources/application.properties values with valid SQL Server values.

    spring.datasource.url=someurl
    spring.datasource.username=username
    spring.datasource.password=password
  2. Start the API: mvn spring-boot:run

POST API Example

This curl command creates a new user with ID 1234.

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
   "createdAt":"2018-08-07", \ 
   "deleted": false, \ 
   "firstName": "Hacker", \ 
   "fuelConsumption": 0, \ 
   "hardAccelerations": 0, \ 
   "hardStops": 0, \ 
   "id": "1234", \ 
   "lastName": "Test", \ 
   "maxSpeed": 0, \ 
   "profilePictureUri": "https://pbs.twimg.com/profile_images/1003946090146693122/IdMjh-FQ_bigger.jpg", \ 
   "ranking": 0, \ 
   "rating": 0, \ 
   "totalDistance": 0, \ 
   "totalTime": 0, \ 
   "totalTrips": 0, \ 
   "updatedAt": "2018-08-07", \ 
   "userId": "Hacker3" \ 
 }' 'http://localhost:8080/api/user/1234'

PATCH API Example

This updates the fuelConsumption and hardStops fields from the user created above.

curl -X PATCH --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
  "fuelConsumption":20, \ 
  "hardStops":74371 \ 
}

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.