{"id":15211238,"url":"https://github.com/leojimenezg/alura_challengeone_java_3","last_synced_at":"2026-03-09T12:31:23.631Z","repository":{"id":248339645,"uuid":"827586956","full_name":"LeoJimenezG/Alura_ChallengeONE_Java_3","owner":"LeoJimenezG","description":"Oracle ONE Challenge: Forum-Hub, Java BackEnd APIRest using SpringBoot","archived":false,"fork":false,"pushed_at":"2024-12-27T23:59:14.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T22:59:29.752Z","etag":null,"topics":["api-rest","apirestful","auth0","auth0-jwt","backend","jasonwebtoken","java","jwt-authentication","postgresql","spring","spring-boot","spring-mvc","spring-security"],"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/LeoJimenezG.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":"2024-07-12T00:43:12.000Z","updated_at":"2024-12-27T23:59:17.000Z","dependencies_parsed_at":"2025-01-17T16:26:43.077Z","dependency_job_id":"0dedbe11-0cfe-4888-964f-bfcac09b73c9","html_url":"https://github.com/LeoJimenezG/Alura_ChallengeONE_Java_3","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"36085261c4e6039ffdeb16f5d23d2240ea433471"},"previous_names":["leojimenezg/alura_challengeone_java_3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2FAlura_ChallengeONE_Java_3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2FAlura_ChallengeONE_Java_3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2FAlura_ChallengeONE_Java_3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2FAlura_ChallengeONE_Java_3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeoJimenezG","download_url":"https://codeload.github.com/LeoJimenezG/Alura_ChallengeONE_Java_3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242940016,"owners_count":20209883,"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":["api-rest","apirestful","auth0","auth0-jwt","backend","jasonwebtoken","java","jwt-authentication","postgresql","spring","spring-boot","spring-mvc","spring-security"],"created_at":"2024-09-28T08:21:28.962Z","updated_at":"2026-03-09T12:31:23.567Z","avatar_url":"https://github.com/LeoJimenezG.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alura_ChallengeONE_Java_3\nAlura Challenge: Forum-Hub. Java BackEnd API REST\n\nThis API REST system simulates the functionality of a Forum using four main endpoints. It supports the GET, POST, PUT and DELETE http methods.\n\n---\n\n## 📘 How does it work\n\n- Every endpoint capable of returning an object response, it will return the status code and a json.\n- The system uses PostgresSQL for the database.\n- The url before the endpoints can be adjusted according to the needs. (e.g., `http:/anyserver/ENDPOINT`).\n- The system has four main endpoints: **/login**, **/topic**, **/author** and **/answer**. Each one of them correspond to different aspects and will vary on the http methods allowed.\n\n---\n\n## 💻 Main Endpoints\n\n### Endpoint(\"/login\"):\n- The only http method it accepts is POST.\n- This endpoint does not require any kind of authorization, so anyone can access to it.\n- You need to send a Json with valid credentials in order to recive a JsonWebToken that will allow you to access all the other endpoints.\n- Example of the Json with credentials:\n\n  ![image](https://github.com/user-attachments/assets/a4c2b858-756e-4c88-b442-319e71305803)\n- If your credentials are valid you will recive your JWT and it will valid for two hours according to the UTC(-06:00).\n   - Example of successful response:\n\n     ![image](https://github.com/user-attachments/assets/da7064a0-b052-485b-8c56-1b8db29d403e)\n   - If your credentials are not valid you will recive a 403 status code.\n- Once you have recived your JWT, you will be able to access all the other endpoints.\n\n### Endpoint(\"/topic\"):\n- This endpoint will accept GET, POST, PUT and DELETE http methods.\n- Only the active topics will be considered for this functions (`status = true`).  \n- #### Method POST:\n   - To register a new topic, you need to send a Json which can't have empty information.\n   - Example of a valid Json:\n   \n      ![image](https://github.com/user-attachments/assets/faf32e28-b286-4d36-903b-644d434bac32)\n   - If the request is successful you will get a 201 status code, the created object and its location `http:/server/topic/TOPIC_ID`):\n\n     ![image](https://github.com/user-attachments/assets/49fd8029-eb95-44f2-ba72-e8e3613be7b5)\n   - If you try to register a topic with the same `title` and `message` that another topic, you will get a 400 status code.\n    \n   \n- #### Method GET:\n   - **Endpoint(\"/all\")**:\n      - This endpoint will return a list of all the topics in a Json format.\n      - Example of sucessful response:\n\n        ![image](https://github.com/user-attachments/assets/174d3653-be7d-4baf-85cf-4b38ba95b940)\n\n  - **Endpoint(\"/firstTen\")**:\n      - This endpoint will return a list of ten topics in ascending order according to their `creation_date`.\n\n  - **Endpoint(\"/title/{title}\")**:\n      - This endpoint allowes you to search a topic by its exact title.\n      - An example of a request is `http:/server/topic/title/example-of-title`.\n      - If the topic is found, you will recive a Json object:\n\n        ![image](https://github.com/user-attachments/assets/d9062c2b-360c-4590-bb39-6d510afc25ba)\n      - If the topic is not found, you will get a 404 status code.\n\n  - **Endpoint(\"/author/{id}\")**:\n      - This endpoint allowes you to search a topic by an author's id.\n      - An example of a request is `http:/server/topic/author/2`.\n      - If the author's id and topic is found, you will recive a list of topics in a Json format:\n\n        ![image](https://github.com/user-attachments/assets/de89c582-b9b5-4933-a008-b6caf9435da5)\n      - If the author's id or topic is not found, you will get a 404 status code.\n    \n   - **Endpoint(\"/course/{id}\")**:\n      - This endpoint allowes you to search a topic by a course's id.\n      - An example of a request is `http:/server/topic/course/4`.\n      - If the course's id and topic is found, you will recive a list of topics in a Json format:\n        \n        ![image](https://github.com/user-attachments/assets/243992a1-133a-47b9-828e-180193c54135)\n       - If the course's id or topic is not found, you will get a 404 status code.\n\n  - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to search a topic by its id.\n      - An example of a request is `http:/server/topic/1`.\n      - If the topic is found, you will recive a Json object:\n        \n        ![image](https://github.com/user-attachments/assets/d9e0d443-aeb8-4455-94eb-54dab6e233ad)\n      - If the topic is not found, you will get a 404 status code.\n\n        \n- #### Method PUT: \n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to update a topic by its id.\n      - Example of a valid Json to update a topic:\n        \n        ![image](https://github.com/user-attachments/assets/5b798bb5-a1e2-497f-a05b-7e231f6126b8)\n      - You can omit any of the Json properties as this is only an update. \n      - If the topic is found and the Json is valid, you will recive a Json of the updated object:\n      \n        ![image](https://github.com/user-attachments/assets/44764e6e-5b30-4559-baa0-7784b49351fb)\n      - If the topic is not found, you will get a 404 status code.\n\n\n- #### Method DELETE:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to delete a topic by its id.\n      - If the topic is found, you will only get a 200 status code.\n      - If the topic is not found, you will get a 404 status code.\n\n\n\n### Endpoint(\"/author\"):\n- This endpoint will accept GET and PUT http methods.\n- #### Method GET:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to search an author by its id.\n      - An example of a request is `http:/server/author/1`.\n      - If the author is found, you will recive a Json object:\n   \n        ![image](https://github.com/user-attachments/assets/5a39801e-9b4b-4bc5-bffd-4cc2c03757d4)\n      - If the author is not found, you will get a 404 status code.\n        \n   - **Endpoint(\"/name/{name}\")**:\n      - This endpoint allowes you to search an author by its exact name.\n      - An example of a request is `http:/server/author/name/Pedro-Hernandez`.\n      - If the author is found, you will recive a Json object:\n\n        ![image](https://github.com/user-attachments/assets/5a39801e-9b4b-4bc5-bffd-4cc2c03757d4)\n      - If the author is not found, you will get a 404 status code.\n    \n   - **Endpoint(\"/email/{email}\")**:\n      - This endpoint allowes you to search an author by its exact email.\n      - An example of a request is `http:/server/author/email/pedro123@gmail.com`.\n      - If the author is found, you will recive a Json object:\n\n        ![image](https://github.com/user-attachments/assets/5a39801e-9b4b-4bc5-bffd-4cc2c03757d4)\n      - If the author is not found, you will get a 404 status code.\n\n\n- #### Method PUT:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to update an author by its id.\n      - Example of a valid Json to update an author:\n\n        ![image](https://github.com/user-attachments/assets/0e608cd3-07a7-4102-ac0c-f369ad6f2b66)\n      - You can omit any of the Json properties as this is only an update. \n      - If the author is found and the Json is valid, you will revice a Json of the updated object:\n\n        ![image](https://github.com/user-attachments/assets/d9314ccc-a294-445d-9009-9108eb6b4af0)\n      - If the author is not found, you will get a 404 status code.\n\n### Endpoint(\"/answer\"):\n- This endpoint will accept GET, POST, PUT and DELETE http methods.\n- #### Method GET:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to search an answer by its id.\n      - An example of a request is `http:/server/answer/1`.\n      - If the answer is found, you will recive a Json object:\n\n        ![image](https://github.com/user-attachments/assets/1ba26c27-48cd-41fe-b19e-838693428b5b)\n      - If the answer is not found, you will get a 404 status code.  \n- #### Method POST:\n   - **Endpoint(\"/add\")**: \n      - This endpoint allowes you to add a new answer.\n      - You need to send a Json which can't have empty information.\n      - Example of a valid Json:\n\n        ![image](https://github.com/user-attachments/assets/8efc9e1e-a978-48fc-a5d1-baf963287c6c)\n      - If the request is successful you will get a 201 status code, the created object and its location `http:/server/answer/ANSWER_ID`:\n\n        ![image](https://github.com/user-attachments/assets/2f858d01-da97-415c-bd35-6d202e936cad)\n      - If your request is missing something or it is not correct, you will get a 400 status code.\n- #### Method PUT:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to update an answer by its id.\n      - Example of a valid Json to update an answer:\n\n        ![image](https://github.com/user-attachments/assets/963a3611-77e2-497f-ba54-9ce51554445f)\n      - You can omit any of the Json properties as this is only an update. \n      - If the answer is found and the Json is valid, you will revice a Json of the updated object:\n\n        ![image](https://github.com/user-attachments/assets/219a3313-ed21-4cfd-98aa-10b608d8056d)\n      - If the answer is not found, you will get a 404 status code.\n- #### Method DELETE:\n   - **Endpoint(\"/{id}\")**:\n      - This endpoint allowes you to delete an answer by its id.\n      - If the answer is found, you will only get a 200 status code.\n      - If the answer is not found, you will get a 404 status code.\n\n---\n\n ## 🔐 Security Considerations\n\n- The API uses JWT (JSON Web Token) for authentication and authorization.\n- The token must be included in the `Authorization` header for all requests except the `/login` endpoint.\n- Ensure secure storage of tokens on the client side.\n\n---\n\n## 📚 Useful Resources\n\n- [Spring Boot docs](https://spring.io/projects/spring-boot)\n- [JWT introduction](https://jwt.io/introduction)\n- [PostgresSQL docs](https://www.postgresql.org/docs/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojimenezg%2Falura_challengeone_java_3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleojimenezg%2Falura_challengeone_java_3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojimenezg%2Falura_challengeone_java_3/lists"}