Tuesday, August 26, 2014

Simulate mobile accessing Rails API

You might be using Rails API to create a back end while the view layer is handled by mobile application. So how do you simulate sending headers to the API (i.e: authentication). You can use terminal and do a curl command:

curl \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "User-Token: 18773930-285a-434a-b044-533252e49435" \
-X POST \
-d '{"following": {"username": "sentul"}}' \
http://localhost:3000/followings


No comments:

Post a Comment