Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

[REST API] Added HTTP status codes for bad auth/requests #1264

Merged
merged 5 commits into from
Sep 1, 2016
Merged

[REST API] Added HTTP status codes for bad auth/requests #1264

merged 5 commits into from
Sep 1, 2016

Conversation

Sieberkev
Copy link
Collaborator

@Sieberkev Sieberkev commented Aug 31, 2016

Fixed issue: #1139 (comment)

Changes made:

  • Added status codes on bad requests 400 (the server cannot or will not process the request due to something that is perceived to be a client error)/ auth 401
  • Updated API.md file

@Sieberkev
Copy link
Collaborator Author

Pinging @JoeyyT to see if this has any negative consequences on your GUI (it shouldn't, with the codes it should be even be better to catch errors any errors (when the statuscode is not 200)).

- POST `/api/bot/{name}/pokemon/{id}/evolve` => Evolve pokemon
- POST `/api/bot/{name}/pokemon/{id}/powerup` => Power-up pokemon
- POST `/api/bot/{name}/pokemon/{id}/evolve` => Evolve pokemon (HTTP status code 400 (Bad Request) when not enough candy)
- POST `/api/bot/{name}/pokemon/{id}/powerup` => Power-up pokemon (HTTP status code 400 (Bad Request) when not enough candy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..or stardust

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a stardust check (that was missing).

@FrancYescO
Copy link
Contributor

FrancYescO commented Aug 31, 2016

nothing will change for TTL55, rather will be better, cause it's already in the js to show a failed message if not a 200 response received.

if (count == 0) {
httpResponse.status = HttpServletResponse.SC_BAD_REQUEST
return "Not enough incense"
} else {
itemBag.useIncense()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log if usage successfull? maybe also for luckyegg and location change request

@Sieberkev Sieberkev merged commit df7afe3 into jabbink:develop Sep 1, 2016
@Sieberkev Sieberkev deleted the rest_api_status_codes branch September 1, 2016 21:53
Sieberkev added a commit that referenced this pull request Sep 6, 2016
* fix build

* Updated AUTHORS.md (#1262)

* API.md - Slashes missing in documentation (#1263)

* Add checkstyle to Gradle build (#1246)

* Enabled Checkstyle in Gradle
* Added checkstyle to build.gradle (only check "src/main/kotlin" and not the libraries)
* Fixed several checkstyle errors (File contains tab characters, Space needed before opening parenthesis, Line has trailing spaces) so the current checkstyle.xml builds without errors

* * Added check to avoid "){"

* [REST API] Added HTTP status codes for bad auth/requests (#1264)

* * Added status codes on bad requests/auth
* Updated API.md file

* * Replaced string concatenations with proper ${}'s and cleaned up some sentences
* Added missing stardust check on powerup

* * Update API.md with stardust check

* * Added more console logging
* Cleanup some one-use vars

* Improved config loading/saving (#1270)

* Remove unused ProgramController
* Renamed util.io.export*Writer classes/files
* Moved BotService save/load to new class/file util.io.SettingsJSONWriter

* Fix REST API pokedex indexes (#1275)

* Fix missing pokemons (missingno #0, mew #151) in REST API pokedex call
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants