|
| 1 | +# Wordle API |
| 2 | + |
| 3 | +Welcome to the backend API for the Wordle game! This API allows you to start a new game session, submit guessed words, and retrieve game status. You can access the frontend web version of the Wordle game at https://wordle.otech.id. |
| 4 | + |
| 5 | +## Endpoints |
| 6 | + |
| 7 | +### Session |
| 8 | + |
| 9 | +#### GET /api/session |
| 10 | + |
| 11 | +Retrieves a session code for a new game. |
| 12 | + |
| 13 | +**Response** |
| 14 | + |
| 15 | +```json |
| 16 | +{ |
| 17 | + "sessionCode": "{session code}" |
| 18 | +} |
| 19 | +``` |
| 20 | + |
| 21 | +### Words |
| 22 | + |
| 23 | +#### GET /api/play?session={session code} |
| 24 | + |
| 25 | +Starts a game session with the specified session code. |
| 26 | + |
| 27 | +**Response** |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "resCode": 1, |
| 32 | + "message": "Session Not Found!" |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "resCode": "OK", |
| 39 | + "session": "{session code}" |
| 40 | +} |
| 41 | + |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +#### POST /api/guessed |
| 46 | + |
| 47 | +Submits a guessed word for the specified session. |
| 48 | + |
| 49 | +**Request Body** |
| 50 | + |
| 51 | +```json |
| 52 | +{ |
| 53 | + "session": "{session code}", |
| 54 | + "guessed": ["{array of alphabet}"] |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +**Response** |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "resCode": 1, |
| 63 | + "message": "Session Not Found!" |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +```json |
| 68 | +{ |
| 69 | + "session": "{session code}", |
| 70 | + "resCode": 2, |
| 71 | + "message": "Words Not Found!" |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "session":"{session code}", |
| 78 | + "resCode": "OK", |
| 79 | + "guessed": ["{array of guessed words}"], |
| 80 | + "message": "You Lose!" |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +```json |
| 85 | +{ |
| 86 | +"session": "{session code}", |
| 87 | +"resCode": "OK", |
| 88 | +"guessed": ["{array of guessed words}"], |
| 89 | +"message": "Added guessed word!" |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +```json |
| 94 | +{ |
| 95 | + "session":"{session code}", |
| 96 | + "resCode": "OK", |
| 97 | + "guessed": true, |
| 98 | + "message": "You Win!" |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +## Usage |
| 103 | + |
| 104 | +To use this API, simply send a request to the appropriate endpoint with the required parameters. The response will be a JSON object containing the relevant data. |
| 105 | + |
| 106 | +## Contributions |
| 107 | + |
| 108 | +We welcome contributions to this project. If you have an idea for a new feature or have found a bug, please open an issue so we can discuss it. If you'd like to make a pull request, please follow the guidelines below: |
| 109 | + |
| 110 | +1. Fork the repository. |
| 111 | +2. Create a new branch for your feature. |
| 112 | +3. Make your changes. |
| 113 | +4. Test your changes to ensure they work as expected. |
| 114 | +5. Commit your changes and push to your branch. |
| 115 | +6. Open a pull request, describing the changes you've made and why they are necessary. |
| 116 | + |
| 117 | +## License |
| 118 | + |
| 119 | +This project is licensed under the MIT License. |
| 120 | +``` |
| 121 | +MIT License |
| 122 | +
|
| 123 | +Copyright (c) 2022 Mikail Asada |
| 124 | +
|
| 125 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 126 | +of this software and associated documentation files (the "Software"), to deal |
| 127 | +in the Software without restriction, including without limitation the rights |
| 128 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 129 | +copies of the Software, and to permit persons to whom the Software is |
| 130 | +furnished to do so, subject to the following conditions: |
| 131 | +
|
| 132 | +The above copyright notice and this permission notice shall be included in all |
| 133 | +copies or substantial portions of the Software. |
| 134 | +
|
| 135 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 136 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 137 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 138 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 139 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 140 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 141 | +SOFTWARE. |
| 142 | +``` |
0 commit comments