项目作者: daniel-cottone

项目描述 :
RESTful API written in Java using Spring Framework.
高级语言: Java
项目地址: git://github.com/daniel-cottone/PhotoAlbum-api.git
创建时间: 2015-06-02T01:53:24Z
项目社区:https://github.com/daniel-cottone/PhotoAlbum-api

开源协议:MIT License

下载


PhotoAlbum

About

This is an example RESTful API written in Java and Spring Framework. This project is intended to be a demonstration of how a REST API can be structured and designed using Spring Boot/Actuator and Spring Data.

Installation

To run this application you will first need to install a couple packages: jdk 1.7 and maven (you can also install these packages with yum, brew, etc.)

  1. sudo apt-get install openjdk-7-jre
  2. sudo apt-get install maven

This project is built using Spring Boot/Spring Actuator, which makes it very easy to get running. You can either run the application directly from maven: mvn spring-boot:run, or you can build the application package with mvn clean package and then run the jar directly: java -jar target/PhotoAlbum-1.0-SNAPSHOT.jar.

Usage

The default username/password for this application is user:user. To access any of the endpoints you will be prompted for authorization.

The relevant endpoints for this application are /api/photos and /api/albums. Both endpoints have the basic CRUD actions. For example, to view all photos, you can navigate to:

  1. http://localhost:8080/api/photos

Which should return the following JSON:

  1. [
  2. {
  3. "id": "1",
  4. "title": "just me",
  5. "createdDate": "2015-08-31T09:14:05.097-0500",
  6. "filePath": "me.png",
  7. "albumId": "1"
  8. },
  9. {
  10. "id": "2",
  11. "title": "another pic",
  12. "createdDate": "2015-08-31T09:14:05.097-0500",
  13. "filePath": "another.png",
  14. "albumId": "1"
  15. },
  16. {
  17. "id": "3",
  18. "title": "profile photo",
  19. "createdDate": "2015-08-31T09:14:05.098-0500",
  20. "filePath": "profile.png",
  21. "albumId": "1"
  22. },
  23. {
  24. "id": "4",
  25. "title": "at the beach",
  26. "createdDate": "2015-08-31T09:14:05.098-0500",
  27. "filePath": "beach.png",
  28. "albumId": "2"
  29. },
  30. {
  31. "id": "5",
  32. "title": "at the park",
  33. "createdDate": "2015-08-31T09:14:05.098-0500",
  34. "filePath": "park.png",
  35. "albumId": "2"
  36. }
  37. ]

For testing all of the CRUD actions, I recommend using Postman.