Syosset/syosset

App still uses old day color endpoint

Closed this issue ยท 5 comments

@rlefkowitz Can you update your app to fetch the day color from https://syosseths.com/day instead of https://syosseths.com/day_color?

If you can update the issue when done so we can remove the old endpoint that'd be great ๐Ÿ‘

I can get the update submitted by Monday, although I have to remove notifications temporarily due to some logistical issues with the developer account.

As of 91dd8fb the /day API is following a different format (legacy route remains unaffected). I've already informed @jweiss045, but it might be nice to have it documented here.

If I were you guys, instead of just ripping through the api output, I would implement a jsonapi deserializer.
You can use our serializers as a reference for what data to extract.

Examples of what the new API returns:
No School:
{"data":{"id":"current_day_color","type":"days","attributes":{"color":"No Color"},"relationships":{"closure":{"data":null}}},"jsonapi":{"version":"1.0"}}

Red Day:
{"data":{"id":"current_day_color","type":"days","attributes":{"color":"Red Day"},"relationships":{"closure":{"data":null}}},"jsonapi":{"version":"1.0"}}

White Day:
{"data":{"id":"current_day_color","type":"days","attributes":{"color":"White Day"},"relationships":{"closure":{"data":null}}},"jsonapi":{"version":"1.0"}}

Active Closure:
{"data":{"id":"current_day_color","type":"days","attributes":{"color":"No Color"},"relationships":{"closure":{"data":{"type":"closures","id":"5a4ec95f366a3530e7f41865"}}}},"included":[{"id":"5a4ec95f366a3530e7f41865","type":"closures","attributes":{"type":"snow","content":"This is due to the road and weather conditions. All activities will be cancelled including SCOPE.","start_date":"2018-01-03","end_date":"2018-01-04"}}],"jsonapi":{"version":"1.0"}}

note: whole API is heavily subject to change, especially right now that it's just being formed

I have updated the Android version of the app with the new API.

@rlefkowitz @jweiss045 Are we good to remove the outdated endpoint now?