{"id":20196202,"url":"https://github.com/shaikrasheed99/springboot-hateoas","last_synced_at":"2025-06-15T09:08:30.308Z","repository":{"id":113142637,"uuid":"564222472","full_name":"shaikrasheed99/springboot-hateoas","owner":"shaikrasheed99","description":"HATEOAS for RESTful APIs using Spring Boot.","archived":false,"fork":false,"pushed_at":"2022-11-11T18:44:45.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T08:58:52.070Z","etag":null,"topics":["hateoas","hateoas-response","java","postgresql","rest-api","spring-boot","spring-hateoas","spring-mvc","tdd","tdd-java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaikrasheed99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-10T09:00:53.000Z","updated_at":"2022-12-30T04:35:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"a85f7f3e-b081-427a-b6ce-2cd954b596f1","html_url":"https://github.com/shaikrasheed99/springboot-hateoas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shaikrasheed99/springboot-hateoas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaikrasheed99%2Fspringboot-hateoas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaikrasheed99%2Fspringboot-hateoas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaikrasheed99%2Fspringboot-hateoas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaikrasheed99%2Fspringboot-hateoas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaikrasheed99","download_url":"https://codeload.github.com/shaikrasheed99/springboot-hateoas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaikrasheed99%2Fspringboot-hateoas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259949682,"owners_count":22936411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hateoas","hateoas-response","java","postgresql","rest-api","spring-boot","spring-hateoas","spring-mvc","tdd","tdd-java"],"created_at":"2024-11-14T04:22:27.371Z","updated_at":"2025-06-15T09:08:29.643Z","avatar_url":"https://github.com/shaikrasheed99.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot HATEOAS\n\n## Gradle based spring boot application which provide Customer, Orders, Products APIs with HATEOAS links using test driven development.\n\n## What is HATEOAS?\n* HATEOAS stands for the Hypermedia(H), As(A), The(T), Engine(E), Of(O), Application(A), State(S). \n* If a consumer of a REST service needs to hard code all the resource URLs, then it is tightly coupled with your service implementation. Instead, if you return the URLs, it could use for the actions, then it is loosely coupled.  \n* It is a way to provide links of the resources in the api response, so that the client does not have to deal with URI construction and business flow. \n* Simply clients make a request, the next URL is given by adding it to the response.\n\n## Features of the Application\n    - Read Customers\n    - Read Customer by Customer Id\n    - Read Products\n    - Read Products by Product Id\n    - Read Orders of a Customer\n    - Read Order of a Customer by Order Id\n    - Read Orders of a Product\n    - Read Order of a Product by Order id\n\n## Customer APIs\n\n### Customers - Get Customers\n\n* Request\n```\nGET /customers\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"_embedded\": {\n        \"customerList\": [\n            {\n                \"id\": 1,\n                \"name\": \"Ironman\",\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"http://localhost:3000/customers/1\"\n                    },\n                    \"collection\": {\n                        \"href\": \"http://localhost:3000/customers\"\n                    },\n                    \"orders\": {\n                        \"href\": \"http://localhost:3000/customers/1/orders\"\n                    }\n                }\n            },\n            {\n                \"id\": 2,\n                \"name\": \"Thor\",\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"http://localhost:3000/customers/2\"\n                    },\n                    \"collection\": {\n                        \"href\": \"http://localhost:3000/customers\"\n                    },\n                    \"orders\": {\n                        \"href\": \"http://localhost:3000/customers/2/orders\"\n                    }\n                }\n            }\n        ]\n    },\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/customers\"\n        }\n    }\n}\n```\n\n### Customers - Get Customer by Customer Id\n\n* Request\n```\nGET /customers/{1}\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"id\": 1,\n    \"name\": \"Ironman\",\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/customers/1\"\n        },\n        \"collection\": {\n            \"href\": \"http://localhost:3000/customers\"\n        },\n        \"orders\": {\n            \"href\": \"http://localhost:3000/customers/1/orders\"\n        }\n    }\n}\n```\n\n## Product APIs\n\n### Products - Get Products\n\n* Request\n```\nGET /products\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"_embedded\": {\n        \"productList\": [\n            {\n                \"id\": 1,\n                \"name\": \"iPhone\",\n                \"price\": 80000.0,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"http://localhost:3000/products/1\"\n                    },\n                    \"collection\": {\n                        \"href\": \"http://localhost:3000/products\"\n                    },\n                    \"orders\": {\n                        \"href\": \"http://localhost:3000/products/1/orders\"\n                    }\n                }\n            },\n            {\n                \"id\": 2,\n                \"name\": \"MacBook Pro\",\n                \"price\": 200000.0,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"http://localhost:3000/products/2\"\n                    },\n                    \"collection\": {\n                        \"href\": \"http://localhost:3000/products\"\n                    },\n                    \"orders\": {\n                        \"href\": \"http://localhost:3000/products/2/orders\"\n                    }\n                }\n            }\n        ]\n    },\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/products\"\n        }\n    }\n}\n```\n\n### Products - Get Product by Product Id\n\n* Request\n```\nGET /products/{1}\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"id\": 1,\n    \"name\": \"iPhone\",\n    \"price\": 80000.0,\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/products/1\"\n        },\n        \"collection\": {\n            \"href\": \"http://localhost:3000/products\"\n        },\n        \"orders\": {\n            \"href\": \"http://localhost:3000/products/1/orders\"\n        }\n    }\n}\n```\n\n## Order APIs\n\n### Orders - Get Orders of a Customer\n\n* Request\n```\nGET /customers/{1}/orders\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"_embedded\": {\n        \"orderList\": [\n            {\n                \"id\": 1,\n                \"customer\": {\n                    \"id\": 1,\n                    \"name\": \"Ironman\"\n                },\n                \"product\": {\n                    \"id\": 1,\n                    \"name\": \"iPhone\",\n                    \"price\": 80000.0\n                },\n                \"quantity\": 2,\n                \"cost\": 160000.0,\n                \"_links\": {\n                    \"self\": [\n                        {\n                            \"href\": \"http://localhost:3000/customers/1/orders/1\"\n                        },\n                        {\n                            \"href\": \"http://localhost:3000/products/1/orders/1\"\n                        }\n                    ],\n                    \"customer\": {\n                        \"href\": \"http://localhost:3000/customers/1/orders\"\n                    },\n                    \"product\": {\n                        \"href\": \"http://localhost:3000/products/1/orders\"\n                    }\n                }\n            },\n            {\n                \"id\": 2,\n                \"customer\": {\n                    \"id\": 1,\n                    \"name\": \"Ironman\"\n                },\n                \"product\": {\n                    \"id\": 2,\n                    \"name\": \"MacBook Pro\",\n                    \"price\": 200000.0\n                },\n                \"quantity\": 1,\n                \"cost\": 200000.0,\n                \"_links\": {\n                    \"self\": [\n                        {\n                            \"href\": \"http://localhost:3000/customers/1/orders/2\"\n                        },\n                        {\n                            \"href\": \"http://localhost:3000/products/2/orders/2\"\n                        }\n                    ],\n                    \"customer\": {\n                        \"href\": \"http://localhost:3000/customers/1/orders\"\n                    },\n                    \"product\": {\n                        \"href\": \"http://localhost:3000/products/2/orders\"\n                    }\n                }\n            }\n        ]\n    },\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/customers/1/orders\"\n        }\n    }\n}\n```\n\n### Orders - Get Order of a Customer by Order Id\n\n* Request\n```\nGET /customers/{1}/orders/{2}\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"id\": 2,\n    \"customer\": {\n        \"id\": 1,\n        \"name\": \"Ironman\"\n    },\n    \"product\": {\n        \"id\": 2,\n        \"name\": \"MacBook Pro\",\n        \"price\": 200000.0\n    },\n    \"quantity\": 1,\n    \"cost\": 200000.0,\n    \"_links\": {\n        \"self\": [\n            {\n                \"href\": \"http://localhost:3000/customers/1/orders/2\"\n            },\n            {\n                \"href\": \"http://localhost:3000/products/2/orders/2\"\n            }\n        ],\n        \"customer\": {\n            \"href\": \"http://localhost:3000/customers/1/orders\"\n        },\n        \"product\": {\n            \"href\": \"http://localhost:3000/products/2/orders\"\n        }\n    }\n}\n```\n\n### Orders - Get Orders of a Product\n\n* Request\n```\nGET /products/{1}/orders\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"_embedded\": {\n        \"orderList\": [\n            {\n                \"id\": 1,\n                \"customer\": {\n                    \"id\": 1,\n                    \"name\": \"Ironman\"\n                },\n                \"product\": {\n                    \"id\": 1,\n                    \"name\": \"iPhone\",\n                    \"price\": 80000.0\n                },\n                \"quantity\": 2,\n                \"cost\": 160000.0,\n                \"_links\": {\n                    \"self\": [\n                        {\n                            \"href\": \"http://localhost:3000/customers/1/orders/1\"\n                        },\n                        {\n                            \"href\": \"http://localhost:3000/products/1/orders/1\"\n                        }\n                    ],\n                    \"customer\": {\n                        \"href\": \"http://localhost:3000/customers/1/orders\"\n                    },\n                    \"product\": {\n                        \"href\": \"http://localhost:3000/products/1/orders\"\n                    }\n                }\n            },\n            {\n                \"id\": 3,\n                \"customer\": {\n                    \"id\": 2,\n                    \"name\": \"Thor\"\n                },\n                \"product\": {\n                    \"id\": 1,\n                    \"name\": \"iPhone\",\n                    \"price\": 80000.0\n                },\n                \"quantity\": 1,\n                \"cost\": 80000.0,\n                \"_links\": {\n                    \"self\": [\n                        {\n                            \"href\": \"http://localhost:3000/customers/2/orders/3\"\n                        },\n                        {\n                            \"href\": \"http://localhost:3000/products/1/orders/3\"\n                        }\n                    ],\n                    \"customer\": {\n                        \"href\": \"http://localhost:3000/customers/2/orders\"\n                    },\n                    \"product\": {\n                        \"href\": \"http://localhost:3000/products/1/orders\"\n                    }\n                }\n            }\n        ]\n    },\n    \"_links\": {\n        \"self\": {\n            \"href\": \"http://localhost:3000/products/1/orders\"\n        }\n    }\n}\n```\n\n### Orders - Get Order of a Product by Order Id\n\n* Request\n```\nGET /products/{1}/orders/{3}\nHost: localhost:3000\n```\n* Response\n```\nStatus code: 200 OK\nBody:\n{\n    \"id\": 3,\n    \"customer\": {\n        \"id\": 2,\n        \"name\": \"Thor\"\n    },\n    \"product\": {\n        \"id\": 1,\n        \"name\": \"iPhone\",\n        \"price\": 80000.0\n    },\n    \"quantity\": 1,\n    \"cost\": 80000.0,\n    \"_links\": {\n        \"self\": [\n            {\n                \"href\": \"http://localhost:3000/customers/2/orders/3\"\n            },\n            {\n                \"href\": \"http://localhost:3000/products/1/orders/3\"\n            }\n        ],\n        \"customer\": {\n            \"href\": \"http://localhost:3000/customers/2/orders\"\n        },\n        \"product\": {\n            \"href\": \"http://localhost:3000/products/1/orders\"\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaikrasheed99%2Fspringboot-hateoas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaikrasheed99%2Fspringboot-hateoas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaikrasheed99%2Fspringboot-hateoas/lists"}