SE17GroupH / ZapServer

Server side stuff for Zap
1 stars 0 forks source link

Magic link api call quotes error #14

Closed thegreyd closed 7 years ago

thegreyd commented 7 years ago

When I make the following call, it returns a bad request:

Instead when you make this call it accepts

The difference between them is in the JSON body, I inter-changed single and double quotes. I am not able to implement the single quotes version in Java, because strings can't be inside single quotes. Please fix this.

DevArenaCN commented 7 years ago

@thegreyd The reason it throws an error is because single quote is not a legal JSON format, you need to use double quotes instead. There's nothing I can do on the server side since there's a strict policy regarding JSON format.

thegreyd commented 7 years ago

even this doesn't work curl -k -v -H "Content-Type:application/json" -X POST -d "{"magiclink":{"email":"sid.sharma0@gmail.com"}}" https://zapserver.herokuapp.com/api/magiclinks/

this used to work in the login request.

thegreyd commented 7 years ago

Here's what I am doing for login request: json_request = String.format("{ \"session\": { \"email\": \"%s\", \"password\": \"%s\" } }",email, passwd);

Here's the magic link json json_request = String.format("{ \"magiclink\": { \"email\": \"%s\" } }",email);

thegreyd commented 7 years ago

Got it. An error in the url.

DevArenaCN commented 7 years ago

Cool. I'm making a change to the return JSON since now it returns nothing after sending the magic link email

DevArenaCN commented 7 years ago

Done. Now it will return a JSON: {"Message":"Magic Link Sent"} if the email is sent out successfully.