Closed medallyon closed 7 years ago
End-point for users will be: api.grogsile.me/esoi/users
End-point for characters will be api.grogsile.me/esoi/users/:user/characters
End-point for (in-game) guilds will be api.grogsile.me/esoi/guilds
End-points for the authenticated user will be replaced with @me
instead of :user
example: api.grogsile.me/esoi/users/@me
As I'm using ajax for the form submission at /new?type=character
, it becomes seemingly impossible to use the authenticated user object for API authentication.
The only reason I'm using ajax in the first place is because of the avatar, anyway. I will see if there's a way for me to convert the avatar data into a hidden base64 string that will be sent with the normal form.
It appears that when trying to fill an HTML input type=text
with the base64 URL, the browser window freezes and eventually kills itself. I'm now thinking of using a back-end image cropping library to crop and save the image.
I had to shift the end-points to https://esoi.grogsile.me/api/:...
because the authenticated user object is not transmitted with the request over to another subdomain (such as https://api.grogsile.me/).
Everything works now, except for the images (images are saved as empty .png
files).
Instead of POSTing to /new every time and basing the actions on the content, create an endpoint for characters (perhaps something like /api/esoi/users/characters) to which one can POST, PATCH, DELETE, etc.
same for guilds