Yo Account Endpoint

Posted in General by David Hao Sat Nov 01 2014 08:14:46 GMT+0000 (UTC)·12·Viewed 2,531 times

I tried using the Yo Account creation endpoint, but I keep getting 403's, even with the provided api console. Is the endpoint broken, or am I doing something wrong?
Or Arbel
Nov 1, 2014

Fixed. Sorry for the inconvenience.

David Hao
Nov 2, 2014

I still couldn't get it to work, something about CSRF and needing a Referer.

Message is below:

CSRF verification failed. Request aborted.
You are seeing this message because this HTTPS site requires a 'Referer header' to be sent by your Web browser, but none was sent. This header is required for security reasons, to ensure that your browser is not being hijacked by third parties.
If you have configured your browser to disable 'Referer' headers, please re-enable them, at least for this site, or for HTTPS connections, or for 'same-origin' requests.

ayago
Nov 4, 2014

-

ayago
Nov 4, 2014

I've tested Yo API with cURL on Mac terminal.
The "yo/yoall/subscribers_count" methods are OK.

But when I use "(creating) account" method, I get the error message below.
Forbidden (403) CSRF verification failed. Request aborted.

Would you tell me what I should correct on my command below?
Any advice is so appreciated. Thank you.

[POST] /accounts/
curl http://api.justyo.co/accounts/ -e http://api.justyo.co/ -A 'Mozilla/4.0' -d api_token=f95... -d new_account_username=eriufhaioerfhuaoi -d new_account_passcode=1

Or Arbel
Nov 5, 2014

Got it. use http://newapi.justyo.co/ for this endpoint only.
For /accounts endpoint use: http://newapi.justyo.co/
Other endpoints: http://api.justyo.co/

Or Arbel
Nov 5, 2014

Fixed on api.justyo.co as well:

curl --data "api_token=d192dd6298c390d662c69a68bac&new_account_username=SADFSAFASDFS22DA&new_account_passcode=2553" http://api.justyo.co/accounts

ayago
Nov 5, 2014

Thanks for your reply. But the responses are

"500 Internal Server Error" on http://newapi.justyo.co/accounts
"Server Error (500)" on http://api.justyo.co/accounts

-

/yo/ gives me proper messages toward imperfect commands.

$ curl http://api.justyo.co/yo/
=> "Method 'GET' not allowed."
$ curl http://api.justyo.co/yo/ -X POST
=> "missing username parameter"
$ curl http://api.justyo.co/yo/ -X POST -d username=ayago
=> "please send a valid api_token 2"
$ curl http://api.justyo.co/yo/ -X POST -d api_token=my_token -d username=ayago
=> {"result": "OK"}

But /account/ doesn't...

$ curl http://api.justyo.co/accounts/
=> "Method 'GET' not allowed."
$ curl http://api.justyo.co/accounts/ -X POST
=> "Server Error (500)"

ayago
Nov 6, 2014

line feed was deleted forcibly.

Or Arbel
Nov 8, 2014

500 fixed. it was returning 500 when the api token was invalid. make sure you use a valid token. (the one in the example is not a valid token)

ayago
Nov 8, 2014

Thanks for your reply. But 500.

Would you show me what message is returned for valid api token on terminal?

---[POST] /accounts/---
$ curl http://api.justyo.co/accounts
{"detail": "Method 'GET' not allowed."}
-
$ curl http://api.justyo.co/accounts -X POST

<h1>Server Error (500)</h1>
-
$ curl --data "api_token=f95225cb…&new_account_username=efheufrhbeirfhi&new_account_passcode=1234” http://api.justyo.co/accounts

<h1>Server Error (500)</h1>

—[POST] /yo/---
$ curl http://api.justyo.co/yo/
{"detail": "Method 'GET' not allowed."}
-
$ curl http://api.justyo.co/yo/ -X POST
"missing username parameter"
-
$ curl http://api.justyo.co/yo/ -X POST -d username=my_uname
{"code": 141, "error": "please send a valid api_token 2"}
-
$ curl http://api.justyo.co/yo/ -X POST -d api_token=f95225cb… -d username=my_uname
{"result": "OK"}

Or Arbel
Nov 21, 2014

curl --data "api_token=e2ad0ff1-2085-39d7-9488-0fa8b012b922f&new_account_username=SADFSA&new_account_passcode=2553" http://0.0.0.0:3000/accounts/
{
"api_token": "869d0466-f758-46b7-b1d5-e42f64824a97",
"callback_url": null,
"email": "",
"name": "SADFSA",
"needs_location": false,
"username": "SADFSA"
}

Or Arbel
Nov 21, 2014

curl --data "api_token=e2ad0ff1-2085-39d7-9488-0fa8b012b92f&new_account_username=SADFSA&new_account_passcode=2553" http://api.justyo.co/accounts/
{
"api_token": "869d0466-f758-46b7-b1d5-e42f64824a97",
"callback_url": null,
"email": "",
"name": "SADFSA",
"needs_location": false,
"username": "SADFSA"
}

  
Markdown is allowed